-4

不知道为什么以下不起作用:

SELECT Menus.Id, MealTimes.Id, 
  Menus.MealTime_Id, CAST(MealTimes.Name AS TEXT) as MName, 
  CONVERT(VARCHAR(10), Menus.Date, 126) as Date, 
  CAST(Dishes.Name AS TEXT) as Name 
FROM C 
JOIN Menus 
  ON Menus.MealTime_Id=MealTimes.Id 
JOIN MenuDish 
  ON MenuDish.Menus_Id=Menus.Id 
JOIN Dishes 
  ON Dishes.Id=MenuDish.Dishes_Id 
WHERE C.Id=110 AND Menus.Date BETWEEN "2013-01-21" AND "2013-01-25"

它现在抛出以下错误:

无法绑定多部分标识符“MealTimes.Name”。

我的加入基本上是这样的:

$this->db->join('Menus', 'Menus.MealTime_Id=MealTimes.Id');
    $this->db->join('MenuDish', 'MenuDish.Menus_Id=Menus.Id');  
    $this->db->join('Dishes', 'Dishes.Id=MenuDish.Dishes_Id');

谢谢你的帮助。

4

1 回答 1

0

您的查询中没有MealTimes表/别名。

于 2013-01-21T15:03:22.987 回答