如何在一个查询中执行此操作?
@Input = Select id from table2 where title="hh"
Output = `Select * from table1 where id=@Input
TABELE1
ID | B1 | B2 | B3 |
---|---|---|---|
1 | 阿尔法 | QWER | 好的 |
2 | 太棒了 | ASDF | 好的 |
3 | 查理 | ZXCV | 好的 |
TABLE2
ID | C1 | C2 |
---|---|---|
1 | 太棒了 | ONETWO |
2 | 太棒了 | TRENETWUR |
3 | 查理 | 五六 |
4 | 阿尔法 | 第七天 |
Select * from TABLE1 where B1= (Select C1 from TABLE2 where concat(C2) like '%NETW%')
这正是我想要做的。但是上面的查询仍然不起作用。因此,我更喜欢 TABLE1
中的行。
答案 0 :(得分:0)
您可以使用以下代码段:
Output = Select * from table1 where id= (Select id from table2 where title=
"hh");