gpt4 book ai didi

sql - 如何根据另一张表的引用数据过滤一张表的数据?

转载 作者:行者123 更新时间:2023-12-04 15:25:06 24 4
gpt4 key购买 nike

我有两张 table account_agentbulk_index .每个表上的数据如下
account_agent

name         code         account         remark         scheme
avi 10 151362 first as
babi 11 123478 new as
avi 10 151721 new as
avi 10 151765 new as
sam sas/01 925458 tin sas
bulk_index
agentcode         account          customer_name
10 151362 Alok
22 265721 Rohan
10 151721 Akash

使用这些表我想要结果 account_agent表如下
account_agent
name         code         account         remark
avi 10 151362 first
avi 10 151721 new

我试过查询
select * from account_agent where code = '10' and account = (select account from bulk_index where code = '10')

最佳答案

这个查询对我有用

SELECT A.name, A.code, A.Account, A.remark, A.scheme
FROM account_agent A
INNER JOIN bulk_index B ON A.account = B.account
WHERE A.scheme = 'as' AND A.code = '10'

关于sql - 如何根据另一张表的引用数据过滤一张表的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30355757/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com