Miomir Dancevic
Miomir Dancevic

Reputation: 6852

Mysql query join two tables with same value?

I have this kind of query, i will try to make it so simple to understand, he query is much bigger :)

$query = "SELECT * FROM Artist";
$query2= "SELECT * FROM News";

All table structure in Artist and in News is the same rows etc

ID Title Posts

Is it possible to join this two queries in one, and do something like shuffle ($query);

Upvotes: 0

Views: 251

Answers (1)

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171371

select ID, Title, Posts from Artist, 'Artist' as Type
union all
select ID, Title, Posts from News, 'News' as Type

Upvotes: 2

Related Questions