1
我有這樣的查詢:顯示器1如果所有分組的行是1,否則顯示0
select *, sum(services.amount) as service_amount from invoices
left join projects using(project_id)
left join services using(invoice_id)
where client_id = ?
group by project_id
order by issue_date desc
在表invoices
我有一個柱paid
其是tinyint
即1
或0
。
添加到查詢我有,我怎樣才能使返回paid
列顯示1
如果所有的分組paid
列行等於1
否則顯示0
爲paid
列?
我喜歡這個解決方案! – 2013-04-26 21:26:54
歡迎您:d – 2013-04-26 21:46:56