gpt4 book ai didi

MYSQL 比较 LEFT JOIN 中的多个值

转载 作者:行者123 更新时间:2023-11-30 01:13:02 25 4
gpt4 key购买 nike

如何比较左连接中的多个值?

我有两张 table

table aid val1   a2   b3   c4   atable bval fullforma    appleb    bananac    cat

I would write,

select a.id, b.fullform from a left join b on a.val=b.val

我假设它将加入 a=a 或 b=b

我想这样比较,

select a.id, b.fullform from a left join b on a.val in (a,b)

不写在WHERE中是否可以。

最佳答案

你很接近:

select a.id, b.fullform from a left join b on a.val = b.val
where a.val in (a,b)

关于MYSQL 比较 LEFT JOIN 中的多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19312767/

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