![](/img/trans.png)
[英]MySQL: Joining two tables / Read all data from specific row in table B if specific field in table A is not empty
[英]Select specific data from main table on joining in MySQL
您可以嘗試此查詢
SELECT table1.product_name FROM `table1`
INNER JOIN table2 on table2.p_id = table1.p_id
WHERE table2.user_id = 11
我猜下面的查詢應該工作。
SELECT p1.p_id,p1.product_name FROM table_1 AS p1
INNER JOIN table_2 AS p2
ON p2.p_id = p1.p_id
WHERE p2.user_id = '11'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.