Re: [SQL ] Like 後的count計算

作者: bohei (run and fall)   2014-01-21 17:51:25
2.
SELECT ID,COUNT(*) FROM (SELECT ID FROM tab WHERE ItemNum LIKE '%60001%'
UNION ALL
SELECT ID FROM tab WHERE ItemNum LIKE '%60003%'
UNION ALL
SELECT ID FROM tab WHERE ItemNum LIKE '%60005%')
GROUP BY ID
不知還有沒有更精簡的寫法,還請大家指教,謝謝!
作者: CGS0 (Mike Chen)   2014-02-03 20:59:00
用 or 取代 union

Links booklink

Contact Us: admin [ a t ] ucptt.com