0

我有一个查询

SELECT foodjoint_id FROM provider_food_joints WHERE foodjoint_name='".$foodjoint_name."'";

现在我必须从另一个有 foodjoint_id 归档的表中选择所有信息

SELECT *  AND foodjoint_name FROM  provider_food_joints  from menu_item where foodjoint_id = THOSE ID

我必须加入这两个

4

3 回答 3

2
SELECT provider_food_joints.*, 
       menu_item.* 
FROM   provider_food_joints 
       INNER JOIN menu_item 
               ON menu_item.foodjoint_id = provider_food_joints.foodjoint_id 
WHERE  provider_food_joints.foodjoint_name = '".$foodjoint_name."' 
于 2012-05-30T09:26:04.223 回答
1
SELECT * FROM  provider_food_joints a join menu_item b 
on a.foodjoint_id = b.foodjoint_id where foodjoint_name='".$foodjoint_name."'"
于 2012-05-30T09:27:06.817 回答
-3
SELECT *  AND foodjoint_name FROM  provider_food_joints  
WHERE foodjoint_id IN (SELECT foodjoint_id FROM provider_food_joints WHERE foodjoint_name='".$foodjoint_name."'")
于 2012-05-30T09:27:38.450 回答