SQL to select distinct values from table with foreign key -
i have 2 tables: a (a_id int, string fields...) , b (b_id, string field "name" , referenced column a_id).
want select unique values table a b.name like "%somestring%".
you use exists:
select a.* tablea exists ( select 1 tableb b a.a_id = b.a_id , b.name "%somestring%" )
Comments
Post a Comment