运行出现的错误:
MySQL server error report:Array ( [0] => Array ( [message] => MySQL Query Error ) [1] => Array ( [sql] => SELECT top 10 g.goods_id, g.goods_name, g.et_price, g.shop_price AS org_price,ISNULL(mp.user_price, g.shop_price * '1') AS shop_price, g.promote_price, g.promote_start, g.promote_end, g.goods_thumb, g.goods_img, g.goods_brief FROM `shop`.`ecs_goods` AS g LEFT JOIN `shop`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND (( 1 ) ) AND (g.goods_id not in (select top 0 g.goods_id from `shop`.`ecs_goods` AS g LEFT JOIN `shop`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' ORDER BY goods_id DESC) ) [2] => Array ( [error] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10 g.goods_id, g.goods_name, g.et_price, g.shop_price AS org_price,ISNULL(mp' at line 1 ) [3] => Array ( [errno] => 1064 ) )
因该如何改正呢,谢谢!
MySQL server error report:Array ( [0] => Array ( [message] => MySQL Query Error ) [1] => Array ( [sql] => SELECT top 10 g.goods_id, g.goods_name, g.et_price, g.shop_price AS org_price,ISNULL(mp.user_price, g.shop_price * '1') AS shop_price, g.promote_price, g.promote_start, g.promote_end, g.goods_thumb, g.goods_img, g.goods_brief FROM `shop`.`ecs_goods` AS g LEFT JOIN `shop`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND (( 1 ) ) AND (g.goods_id not in (select top 0 g.goods_id from `shop`.`ecs_goods` AS g LEFT JOIN `shop`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' ORDER BY goods_id DESC) ) [2] => Array ( [error] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10 g.goods_id, g.goods_name, g.et_price, g.shop_price AS org_price,ISNULL(mp' at line 1 ) [3] => Array ( [errno] => 1064 ) )
因该如何改正呢,谢谢!
================================================================
mysql 用limit
select ..... where ...... ORDER BY goods_id DESC Limit 0,10;
这种写法。