generalise over sql statements