我想列出來自倫敦的用戶,並且在我的表格中具有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