[英]PHP - Retrieve multiple records from a single mysql table and append to a string
[英]retrieve multiple records from one table
我有一個顯示興趣的表格。 每個興趣都有一個ID。 此刻查詢只帶回一個人一個ID。 它基本上是網站上的過濾器,可按興趣對結果進行排序。
$catwhere = " and e.person_id IN (select escint_person from person_interests_person where escint_person = e.person_id and escint_interest = 26) ";
我希望它顯示來自多個興趣的結果。
所以按照我的基本邏輯,它看起來像這樣
$catwhere = " and e.person_id IN (select escint_person from person_interests_person where escint_person = e.person_id and escint_interest = 26,27,28,29) ";
但顯然這是行不通的。
任何幫助,將不勝感激。
您需要在第二個查詢中使用IN
子句。
where escint_person = e.person_id and escint_interest IN( 26,27,28,29 )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.