Created
May 9, 2020 08:03
-
-
Save spetrunia/a905d51731c58f5439bd9f70c64cdc43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table t2 ( | |
color varchar(32), | |
price int | |
); | |
insert into t2 values ("red", 100), ("blue", 50); | |
insert into t2 select * from t2; | |
insert into t2 select * from t2; | |
set optimizer_switch='firstmatch=off'; | |
explain | |
select * | |
from | |
json_table('[{"color": "blue", "price": 50}, | |
{"color": "red", "price": 100}]', | |
'$[*]' columns( color varchar(100) path '$.color', | |
price text path '$.price' | |
) | |
) as T | |
where | |
T.color in (select color from t2 where t2.price=T.price); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment