我的問題類似於這樣的一個MySQL COUNT() multiple columns。mysql count multiple rows
但對我來說,我怎麼算複式行:
report table:
id t_pro t_price
1. voucher 20.00
2. pro 13.00
3. pro 1x 13.00
4. pro 2x 13.00
5. voucher 20.00
6. pro 1x 13.00
$db->query("SELECT COUNT(*) FROM (SELECT t_pro WHERE t_pro LIKE 'pro%' AS pro_tan, SELECT t_pro WHERE t_pro LIKE 'voucher%' AS voucher) WHERE date=CURDATE() ");
的結果是這樣的:
voucher : 2
pro tan : 4
? – Neal 2011-04-27 16:15:57