DataGridViewRow
上面是我的sql,如果我想在if语句中使用count_invoice_id,是否可能。目前我所做的是再次在invoice.id列重复计数方法。
我想在sql上面的if语句中将'count(invoice.id)'更改为'count_invoice_id'
答案 0 :(得分:3)
您可以使用子查询:
SELECT count_invoice_id, IF(count_invoice_id > 1 , 'true', 'false')
FROM (SELECT COUNT(invoice.id) AS count_invoice_id
FROM invoice
LEFT JOIN discount_offer ON invoice.id = discount_offer.invoice_id) t