moved sql statements here from djsani