码迷,mamicode.com
首页 > 其他好文 > 详细

查询两个表中不同(相同)的数据,并把它们显示出来

时间:2016-09-08 14:45:39      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:

查询两个表中不同的数据
select ecs_brand.brand_id,ecs_brand.brand_name from 表名ecs_brand where ecs_brand.brand_id not in (select distinct ecs_goods.brand_id from 表名ecs_goods where ecs_goods.is_on_sale = 1 AND ecs_goods.is_alone_sale = 1 AND ecs_goods.is_delete = 0) and ecs_brand.is_show=1

查询两个表中相同的数据

select distinct a.brand_id,a.brand_name from ecs_brand a,ecs_goods b where a.is_show=1 and b.is_on_sale = 1 and b.is_alone_sale = 1 and b.is_delete = 0 and a.brand_id = b.brand_id

查询两个表中不同(相同)的数据,并把它们显示出来

标签:

原文地址:http://www.cnblogs.com/hejianrong/p/5852697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!