I have this query on SQL SERVER:
I gives an error and says that there is no column with the name of supervisorname.
Why would that be or what is the correct syntax if I wish to use an alias for a table name and for the name of one of its fields?
Thanks
PK
Code:
SELECT costcentres.ID, costcentres.centrename, supervisors.username as supervisorname FROM costcentres LEFT JOIN users as supervisors on supervisors.id=costcentres.supervisorno WHERE supervisors.supervisorname IS NULL ORDER BY 1 DESC
Why would that be or what is the correct syntax if I wish to use an alias for a table name and for the name of one of its fields?
Thanks
PK