我正在做的是:提取數據以向用戶顯示產品,以便他/她可以評估產品。使用下面的查詢可以正常工作。使用特定標準從兩個表中提取數據
$query = " SELECT table_products.product_name,
table_products.product_expiry,
table_users.name,
table_users.email
FROM table_products
INNER JOIN table_users ON table_users.user_id = table_products.user_id
ORDER BY table_users.id DESC";
現在我想問的是:如何僅顯示用戶尚未評分的產品。一旦用戶對產品進行評級後,該產品不應再由該用戶的查詢獲取。
我有3個表
table_users (user_id, name, email)
table_products (product id_, user_id, product_name, product_expiry)
table_rating (rating_id, user_id, product_id, rating)
,並希望從2個表
獲取數據table_users, table_products
數據中獲取
table_users.name,
table_users.email,
table_products.product_name,
table_products.product_expiry
如何爲這個任務設置查詢一個具體的used_id
感謝您的時間和幫助:)
確定。讓我測試,我會回覆你 –