php - MYSQL | Request from two tables 2 -
i have 2 mysql tables:
a (users table):
id username room
1 user1 1 2 user2 1 3 user3 1 b (blocked users):
id username 1 user3 my request here (i user1 , user2 user3 in block):
select a.id, a.username `table1` a, `table2` b a.roomid = 1 , a.username != b.username but wrong request. thanks!
you need either join 2 tables a&b like
select a.id, a.username `table1` join `table2` b on `table1`.id = `table2`.id a.room = 1 , a.username != b.username or column name room not roomid like
select a.id, a.username `table1` a, `table2` b a.room = 1 , a.username != b.username
Comments
Post a Comment