SELECT g.date,g.description,g.amount AS cash,0 AS cheque FROM generalledger AS g WHERE g.type="cash" AND g.date=?
UNION ALL
SELECT gg.date,gg.description,0 AS cash, gg.amount AS cheque FROM generalledger AS gg WHERE gg.type="cheque" AND gg.date=?
我有这个查询我想检查g.date的& gg.date的参数值为null然后返回所有其他记录,只根据参数值返回记录。
答案 0 :(得分:1)
尝试
AND (g.date=? or ? is null)