Here is my situation:
table A
id int primary key
...
table A1
id int reference A on delete cascade,
code char(2),
...
primary key (id, code)
where multiple entries with the same id but different code may exist in table A1.
Now, is possible to have only one item per id with a selection statement something like the followings:
select a.id, ... from A a join A1 a1 using (id) where code in ('en', 'es')
And ideally, returning the entry with the code 'en' if there is one.
Thanks.