gpt4 book ai didi

mysql - 不带 in 的两个条件查询

转载 作者:行者123 更新时间:2023-11-29 11:48:01 27 4
gpt4 key购买 nike

我有一个如下查询

select * from conv_master cm  
where cm.`from_currency_id` in (select currency_id from currency_master where currency_code = 'USD')
and cm.to_currency_id in (select currency_id from currency_master where currency_code = 'EUR');

有没有办法在不使用in的情况下重写这个查询。谢谢

最佳答案

尝试这个查询:

select * from conv_master cm 
inner join currency_master m1 on cm.from_currency_id = m1.currency_id
inner join currency_master m2 on cm.to_currency_id = m2.currency_id
where m1.currency_code='USD' and m2.currency_code='EUR'

关于mysql - 不带 in 的两个条件查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578505/

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