First query:
SELECT `id`
FROM (`videos`)
WHERE `name` LIKE '%Dragon Ball Z (U.S.)%'
and second
SELECT `vid_id` as id
FROM (`other_names`)
WHERE `name` LIKE '%Dragon Ball Z (U.S.)%'
GROUP BY `vid_id`
All i want get is list of unique ids by LIKE.
Replace ‘and second’ with ‘UNION’. 🙂
UNION(as opposed toUNION ALL) already returns unique items only, so you won’t needGROUP BYorSELECT DISTINCT. You could writeUNION DISTINCTif you think it’s more clear, but you can omit it, since it is the default behaviour ofUNION.