Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15722

Simple alias query

$
0
0
I have this query on SQL SERVER:

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
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

Viewing all articles
Browse latest Browse all 15722

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>