In: 未分类
12 五 2011SELECT g.goods_id,g.cat_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, IFNULL(mp.user_price, g.shop_price * '1') AS shop_price, g.promote_price, g.goods_type, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img FROM `u114287a`.`ecs_goods` AS g LEFT JOIN `u114287a`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND (g.cat_id IN ('8') OR g.goods_id IN ('14','17','31') ) ORDER BY (case when g.cat_id=8 then 1 when g.cat_id IN ('8') then 2 else 3 end),goods_id DESC
ORDER BY (case when g.cat_id=8 then 1 when g.cat_id IN (’8′) then 2 else 3 end)
满足第一个条件排前面,接着满足第二个条件排第二,剩下排第三
QK31欢迎你的到来.