简体   繁体   中英

Where() in (select) H2

I have 2 kinds of software (both Java): One with MySSQL and the other with H2 database. My problem is that in MySQL I have this query:

Select * from X where (1,2,3) in (select 4,5,6 from Y)

But in H2 throw me this error:

Subquery is not a single column query; SQL statement:

I understand basically what this mean but I need to select all values from X that are in Y and I read that this is the most efficient way. The other way could be asign all the values from Y to a Java Object and then put them in to X but I know that this is not the "best" way to do it

Try to modify the query to have single values

Select * from X where CONCAT(1,2,3) in (select CONCAT(4,5,6) from Y)

So instead of 3 columns you have one where all the 3 column values are joined

仅供参考 1.4.200 版现在似乎支持这个

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM