test
test

Reputation: 18200

MySQL Search across two tables

After a search, there's $_GET['lang_know'] and $_GET['lang_learn'] and each would output the 2 iso code of each language selected

How would I make it into one single search query? As in.. search $_GET['lang_learn'] with language_learn and $_GET['lang_know'] with language_know but one ONE query?

Thanks.

Upvotes: 0

Views: 415

Answers (1)

Michiel van Vaardegem
Michiel van Vaardegem

Reputation: 2035

You could do it by using a UNION.

SELECT a, b FROM language_learn WHERE c LIKE '%d%'
UNION
SELECT a, b FROM language_know WHERE c LIKE '%d%'

Upvotes: 2

Related Questions