Please paste the query including the table structures.

Thanks,

Syed