SQL Query changes
for good checkout use this!