是语法错误吗?
SELECT MEAL_TIMEOFDAY,MEAL_NAME FROM APP.MEAL
WHERE MEAL_TYPE = ('Cardio')
WHERE MEAL_TIMEOFDAY = ('Breakfast')
我只需要吃早餐的心脏餐。
答案 0 :(得分:2)
如果您的SQL WHERE
clause中有多个条件,则必须使用logical operators,例如:
SELECT MEAL_TIMEOFDAY
, MEAL_NAME
FROM APP.MEAL
WHERE MEAL_TYPE = 'Cardio'
AND MEAL_TIMEOFDAY = 'Breakfast'
答案 1 :(得分:1)
尝试使用以下内容,以上操作无效:
SELECT MEAL_TIMEOFDAY,MEAL_NAME FROM APP.MEAL -- This will work for the condition you provided
WHERE MEAL_TYPE = 'Cardio' AND MEAL_TIMEOFDAY = 'Breakfast'
或者简单地说:
SELECT MEAL_TIMEOFDAY,MEAL_NAME FROM APP.MEAL -- This is a sample with OR
WHERE MEAL_TYPE = 'Cardio' OR MEAL_TIMEOFDAY = 'Breakfast'
答案 2 :(得分:0)
SQL查询的结构如下:
SELECT [columns] FROM [table name]
WHERE [condition one]
AND [condition 2]
答案 3 :(得分:-1)
用" OR"
替换第二个