John
John

Reputation: 437

MYSQL GROUP BY 2 Tables

I have 2 tables:

games
softwares

And I have the rows:

games:

id | ref_id | title
 1 |   20   |  nikita
 1 |   18   |  simba

softwares:

id | ref_id | title
 1 |   18   |  adware
 1 |   19   |  acdsee

Now I want to do a GROUP BY ref_id and get:

20
18
19

Upvotes: 2

Views: 175

Answers (1)

rahularyansharma
rahularyansharma

Reputation: 10755

select ref_id from games
union 
select ref_id from softwares 

this answer is according to your result needed and table structure you have mention.

Upvotes: 2

Related Questions