Could someone help me to build this sql with criteria
select D.category, D.account, D.officeID, D.id, D.dateReceived, D.amount,D.receivedBy, D.type, D.comment, sum(P.amount)as sumPaid from tblDeposit D, tblPaid P where D.dateReceived <="2009-12-31" and D.category="C" and D.id=P.receiptNo group by P.receiptNo order by D.dateReceived;