i have a query where I'm selecting information from two different tables - I'm doing an inner join and pulling up text values instead of ID's. What's happening tho is the headers for all these columns are not in text format that I want it to be. In my application I have to change all the headers. Here's my query...
SELECT IDClient,t2.Name Dept,t3.Name Position,Salary
FROM TblClientData t1
INNER JOIN tblDataRef t2 ON t1.Dept = t2.ID
INNER JOIN tblDataRef t3 ON t1.Position = t3.ID
WHERE IDClient = 177
SELECT IDClient, t2.Name Dept
SELECT IDClient, t2.Name Dept as [Department]
You have both
Dept and `Department. You only need one:
SELECT IDClient, t2.Name as Department
I always use
as with column aliases. It makes it easier to spot error like this.
Also, there is no need to escape
Department. I find the square braces to be a bit messy when they are not needed.