Ok. This I think should raise a ticket.
I have this code …
SELECT cs.StudentID,
cs.StudentName AS [Full Name],
tc.TradeCatName AS Category,
sp.TradeName AS Trade
FROM (AimsDevelopment.dbo.vwStudentProgramCurrent sp
INNER JOIN AimsDevelopment.dbo.tblTradeCategories tc
ON (sp.TradeCatID = tc.TradeCatID))
INNER JOIN AimsDevelopment.dbo.vwCurrentStudents cs
ON (cs.StudentID = sp.StudentID)
And I have the [Full Name] alias above created when I added that alias in the diagram section.
Now if I want to ORDER BY that field, this is what the QB does …
SELECT cs.StudentID,
cs.StudentName AS [Full Name],
tc.TradeCatName AS Category,
sp.TradeName AS Trade
FROM (AimsDevelopment.dbo.vwStudentProgramCurrent sp
INNER JOIN AimsDevelopment.dbo.tblTradeCategories tc
ON (sp.TradeCatID = tc.TradeCatID))
INNER JOIN AimsDevelopment.dbo.vwCurrentStudents cs
ON (cs.StudentID = sp.StudentID)
ORDER BY Full
Name
ASC
Obviously the ORDER BY created by the QB is syntactically incorrect.
It should have done this …
SELECT cs.StudentID,
cs.StudentName AS [Full Name],
tc.TradeCatName AS Category,
sp.TradeName AS Trade
FROM (AimsDevelopment.dbo.vwStudentProgramCurrent sp
INNER JOIN AimsDevelopment.dbo.tblTradeCategories tc
ON (sp.TradeCatID = tc.TradeCatID))
INNER JOIN AimsDevelopment.dbo.vwCurrentStudents cs
ON (cs.StudentID = sp.StudentID)
ORDER BY [Full Name] ASC
Thanks