I have two mysql tables such as
countriesRanking table
country, clicks
------- -----
0 657
1 3300
2 9050
clickTable table
id, name, clicks, deviceid, country
-- ------ ------ -------- -------
0 player1 33 uniqueid1 0
1 player2 665 uniqueid2 2
2 player3 88 uniqueid3 18
3 player4 5000 uniqueid4 2
I want to retrieve a click value from countriesRanking table where the country is specified and the click value from clickTable where the deviceid is specified.
Something like
SELECT clicks FROM clicksTable WHERE deviceid='$deviceid' UNION SELECT clicks FROM countriesRanking WHERE country='$country'
So if deviceid is uniqueid4 and country is 2, this will return
5000, 9050
Try this:
Check this link SQL FIDDLE DEMO
OUTPUT