弄了1x分鐘,總算跑出來;記錄起來:
(重點在promo_id=M.promo_id)
--
SELECT D.promo_id,D.prod_bar,
(select COUNT(promo_id) from D where promo_id=M.promo_id) as cc
FROM D LEFT OUTER JOIN
M ON D.promo_id = M.promo_id
WHERE ('2011/10/5' BETWEEN M.promo_sdate AND M.promo_edate)
and D.prod_bar='4710008211013'
沒有留言:
張貼留言