我想列出来自伦敦的用户,并且在我的表格中具有NORMAL或GOLD会员类型。如何使用Where Join哪里?
users table
====================
id name city_id user_type
1 Helen 2 NA
2 James 1 PREMIUM
3 David 1 NORMAL
cities table
=============
id name
1 London
2 New York
$londonUsers = $db->get_rows("
SELECT * FROM users
WHERE user_type = ('NORMAL','PREMIUM')
JOIN cities ON cities.id = users.city_id
WHERE name = 'London'
");
我建议你阅读['SELECT'语句](http://dev.mysql.com/doc/refman/5.7/en/select.html)的语法。答案就在那里。 – axiac