我試圖列出JR + SR學生通過他們的大,但它不工作..Sql查詢。嵌套與否?
SELECT
Std_Major,
Std_Class,
AVG(Std_GPA)
FROM
Student
WHERE
Std_Class LIKE 'JR%' AND Std_Class LIKE 'SR%'
GROUP BY
Std_Major,
Std_Class;
我試圖列出JR + SR學生通過他們的大,但它不工作..Sql查詢。嵌套與否?
SELECT
Std_Major,
Std_Class,
AVG(Std_GPA)
FROM
Student
WHERE
Std_Class LIKE 'JR%' AND Std_Class LIKE 'SR%'
GROUP BY
Std_Major,
Std_Class;
也許使用的,而不是的或運營商和
的
SELECT Std_Major, Std_Class, AVG(Std_GPA)
FROM Student
WHERE Std_Class LIKE 'JR%' AND Std_Class LIKE 'SR%'
GROUP BY Std_Major, Std_Class;
這一翻譯
使用
SELECT Std_Major, Std_Class, AVG(Std_GPA)
FROM Student
WHERE Std_Class LIKE 'JR%' OR Std_Class LIKE 'SR%'
GROUP BY Std_Major, Std_Class;
在這種情況下,您必須使用或。
例子:
SELECT Std_Major, Std_Class, AVG(Std_GPA)
FROM Student
WHERE Std_Class LIKE 'JR%' OR Std_Class LIKE 'SR%'
GROUP BY Std_Major, Std_Class;
我想你想'或',而不是'和'。沒有行可能有一列以「JR」和「SR」開頭的列。 – 2014-11-04 12:15:52
我認爲你是對的,但我想要一個組合jr和sr,然後由主要 – qman111 2014-11-04 12:19:03
組,我與@GordonLinoff去,你說std_class開始與JR和std_class開始SR太 – 2014-11-04 12:19:06