Combine these mysql queries from multiple tables -
let have table list of users, , retrieve users table this:
select userid users year = 2012
that generates list of users, more specifically, userid's (digits).
so, lets our list looks (random userids):
1234 9532 0983 2098 1980
in other table, have users favorite colors, 1 entry each color. user 1234 have multiple entries in table (lets phone call fav_colors):
1234 reddish 1234 bluish 9532 yellowish 9532 reddish 0983 bluish 0983 violet
this simplified illustration of concept trying grasp. how can form 1 query show me users year 2012 (from first query), , likes color red? having problem combining queries users table , fav_colors table
thanks
this should results you're looking for
select u.userid, c.color users u bring together fav_colors c on u.userid = c.userid u.year = 2012 , c.color_name = 'red'
mysql
No comments:
Post a Comment