为什么这两条sql结果是一样的
时间:2011-09-01
来源:互联网
SELECT g.goods_id, g.goods_name,g.goods_number,g.goods_img, g.shop_price AS org_price, g.promote_price, IFNULL(mp.user_price, g.shop_price * '1') AS shop_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd FROM `htmlpfnew`.`ecs_goods` AS g LEFT JOIN `htmlpfnew`.`ecs_brand` AS b ON b.brand_id = g.brand_id and g.is_index_pro = 0 LEFT JOIN `htmlpfnew`.`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.is_promote = 1
SELECT g.goods_id, g.goods_name,g.goods_number,g.goods_img, g.shop_price AS org_price, g.promote_price, IFNULL(mp.user_price, g.shop_price * '1') AS shop_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd FROM `htmlpfnew`.`ecs_goods` AS g LEFT JOIN `htmlpfnew`.`ecs_brand` AS b ON b.brand_id = g.brand_id LEFT JOIN `htmlpfnew`.`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.is_promote = 1 and g.is_index_pro = 0
本来想用这两条语句,来检索一些记录。通过g.is_index_pro = 0 这个字段来判断。取出 g.is_index_pro = 0的字段。但是为什么我这样些。两条语句。的检索结果都包含了 g.is_index_pro = 1的记录在内呢
SELECT g.goods_id, g.goods_name,g.goods_number,g.goods_img, g.shop_price AS org_price, g.promote_price, IFNULL(mp.user_price, g.shop_price * '1') AS shop_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd FROM `htmlpfnew`.`ecs_goods` AS g LEFT JOIN `htmlpfnew`.`ecs_brand` AS b ON b.brand_id = g.brand_id LEFT JOIN `htmlpfnew`.`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.is_promote = 1 and g.is_index_pro = 0
本来想用这两条语句,来检索一些记录。通过g.is_index_pro = 0 这个字段来判断。取出 g.is_index_pro = 0的字段。但是为什么我这样些。两条语句。的检索结果都包含了 g.is_index_pro = 1的记录在内呢
作者: xiongbing528 发布时间: 2011-09-01
这代码。。。。。这么长
作者: mingchaoyan 发布时间: 2011-09-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28