You are on page 1of 1

SELECT COALESCE (t1.sdate,t2.

idate) AS [Date],
COALESCE (t1.scode, t2.icode) AS Code,
COALESCE (t1.Spayment, 0) AS Advance,
COALESCE (t2.cutting, 0) AS Cutting,
COALESCE (t1.cash, 0) AS Received,
COALESCE (t1.sremarks1, '-') AS Remarks
FROM (SELECT Scode,Sdate,SPayment,SAdvance,Cash,Sremarks1
FROM tbl_AdvancePayment
WHERE Scode='1'
GROUP BY Scode,Sdate,SPayment,SAdvance,Cash,Sremarks1
) AS t1 FULL OUTER JOIN
(SELECT icode,Idate,Cutting
FROM Incentive_Entry
WHERE icode='1'
GROUP BY icode,Idate,Cutting
) AS t2
ON t1.scode=t2.icode and t1.Sdate=t2.Idate ORDER BY [Date];

select code,'x' as [Status] from tbl_wc WHERE (ct1>2 or ct2>2 or ct3>2 or ct4>2)
select code,'x' as [Status] from mbrt WHERE (ct1>2 or ct2>2 or ct3>2 or ct4>2)

You might also like