简单的从两个表中选择记录

发布于 2025-01-28 23:51:59 字数 275 浏览 2 评论 0原文

我有2个表(Table_a有一个列products_id& table_b有products_id& state) 我的查询需要选择来自表_a的所有production_id与表_b一起加入,除了这些具有状态=打开的products_id。 我尝试了波纹管,但它显示了从table_b记录显示的

记录 存在的地方 (选择product_id,从table_b where table_a.product_id = e_productbak1feb.product_id and state =='open'

I have 2 tables (table_A has one column products_id & table_B has products_id & state)
My query needs to select, all products_id from table_A join with table_B except these products_id that have state = open.
i tried bellow but it displays records from table_B records only

SELECT * FROM table_A
WHERE EXISTS
(SELECT product_id, state FROM table_B WHERE table_A.product_id = e_productBAK1FEB.product_id AND state == 'open'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回首观望 2025-02-04 23:51:59

尝试

select table_A.* from table_A 
join table_B on table_A.product_id = table_B.product_id
where table_B.state != 'open'

Try

select table_A.* from table_A 
join table_B on table_A.product_id = table_B.product_id
where table_B.state != 'open'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文