查詢兩個表中不同(相同)的數據,並把它們顯示出來


查詢兩個表中不同的數據
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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM