C
cinnie
hello
In SQL, is SELECT executed before ORDER BY, or after. Here's why I'm
confused about this;
Consider table tblEmp with fields EmpID, Name_F, Name_L, Wage
SELECT tblEmpID, tblEmp.Name_F & ", " & tblEmp.Name_L AS Name_Full
FROM tblEmp
ORDER BY tblEmp.Wage
This works fine, even though the Wage field in the ORDER BY statement is not
included in the SELECT statement. This makes me think that ORDER BY is
executed BEFORE the SELECT statement has been able to eliminate the Wage
column.
Also, SELECT tblEmpID, tblEmp.Name_F & ", " & tblEmp.Name_L AS Name_Full
FROM tblEmp
ORDER BY Name_Full
This doesn't work because the ORDER BY statement doesn't recognize
Name_Full. This again makes me think that the ORDER BY is executed BEFORE
the SELECT.
But.....
when I research SQL order of operations, most sites seem to claim that the
ORDER BY clause is executed AFTER the SELECT clause. What gives? Any
clarification?
thank you in advance
In SQL, is SELECT executed before ORDER BY, or after. Here's why I'm
confused about this;
Consider table tblEmp with fields EmpID, Name_F, Name_L, Wage
SELECT tblEmpID, tblEmp.Name_F & ", " & tblEmp.Name_L AS Name_Full
FROM tblEmp
ORDER BY tblEmp.Wage
This works fine, even though the Wage field in the ORDER BY statement is not
included in the SELECT statement. This makes me think that ORDER BY is
executed BEFORE the SELECT statement has been able to eliminate the Wage
column.
Also, SELECT tblEmpID, tblEmp.Name_F & ", " & tblEmp.Name_L AS Name_Full
FROM tblEmp
ORDER BY Name_Full
This doesn't work because the ORDER BY statement doesn't recognize
Name_Full. This again makes me think that the ORDER BY is executed BEFORE
the SELECT.
But.....
when I research SQL order of operations, most sites seem to claim that the
ORDER BY clause is executed AFTER the SELECT clause. What gives? Any
clarification?
thank you in advance