Maneesh A N

Maneesh A N

  • NA
  • 179
  • 109.1k

QUERY RETURNS?

Sep 25 2014 2:48 AM
HI
   QUERY SHOULD RETURNS NON MATCHING ROWS REGARDLESS OF PAYMENTID REGARDING THE PARTICULAR DATE..THAT IS NEED..BUT IS THIS QUERY POSSIBLE?
PLEASE MAKE IT CORRECT

select tblpayments.ipaymentid,tblpayments.vpayment,tblpayments.dbilldate from 
(select tblpayments.ipaymentid,tblpayments.vpayment,tblpayments.dbilldate from tblpayments union select  tblexpense.expname,tblexpense.expamount from tblexpense)
LEFT JOIN tblpayments on  tblpayments.ipaymentid=tblexpense.ipaymentid and dbilldate='2014-09-03' 
LEFT JOIN tblexpense on tblpayments.ipaymentid = tblexpense.ipaymentid and dbilldate='2014-09-03'
where tblexpense.dbilldate='2014-09-03'

ERROR FOUND:
                    Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'LEFT'.

Answers (1)