last sql requests moved to if-data