Consolidated conclusion without joining
-
A table
a
c Fields:_id | name | code -----+------+------
is the table
b
c Fields:clientId | itemId | itemType ----------+--------+----------
Help me get a request (without the johns) where all the meanings will be removed.
a
and dynamic columnfoo
with valuetrue/false
which will be displayed, the presence of a table recordb
comparison columnsa._id = b.itemId
♪I guess we should use something like that.
select _id, 'foo' as "i_am_foo" from a;
for the addition of a dynamic column andSELECT EXISTS(SELECT 1 FROM b WHERE true) as "foo";
-
select a.*, -- все поля из а exists (select 1 from b where b.itemId = a._id) foo from a;
https://sqlize.online/?phpses=null&sqlses=93ba242b065faf41b5ba0b1948e5f35e&php_version=null&sql_version=psql14