我婉检索查询涉及到许多表中的数据。 我有一个查询,如下所示
String sql = "SELECT "
+ "s.Food_ID AS 'Sales_FoodID', "
+ "f.Food_Name AS 'foodName' "
+ "FROM Ordering o, Sales s, Food f"
+ " WHERE o.Table_No = " + tableNo + ""
+ " AND o.Paid = '" + NOT_PAID + "'"
+ " AND s.Order_ID = o.Order_ID"
+ " AND f.Food_ID = s.Food_ID;";
resultSet = statement.executeQuery(sql);
没有发现错误,当我运行程序,但在我加入这行得到一个表的列数据:
String orderID = resultSet.getString("foodName");
我给我这个错误:
java.sql.SQLException: Column not found
任何人都知道为什么吗?