一般來說我們的直覺會是這樣下
SELECT * FROM AEQPTRESV WHERE 1=1 AND (LOT_ID = 'U101804270010' AND NX_OPE_NO='090010')OR (LOT_ID = 'U101804270009' AND NX_OPE_NO='090010')OR (LOT_ID = 'U101804270007' AND NX_OPE_NO='090010').........
但是這種作法太耗費效能了, 於是突發奇想是否可以這樣抓
SELECT * FROM AEQPTRESV
WHERE 1=1
AND (LOT_ID , NX_OPE_NO)
IN (
('U101804270010','090010'),
('U101804270009','090010'),
('U101804270007','090010')
)
後來發現竟然可以 😃😃😃
語法改成這樣下,不但畫面比較好看,效能也會比較好哦!!!
沒有留言:
張貼留言