Select screening.screening_cd as code, site_name as site, /*more fields*/ screening_adtl.notes as longNotes
From screening INNER JOIN screening_adtl On screening.screening_cd = screening_adtl.screening_cd
Where code like '07-0328_RIC%'
----- Hi SQL friends: My above SQL script only works when I change the "code" in the last line to "screening.screening_cd". I thought the whole point of the alias was to save myelf from having to use these fully qualified names...!! What am I doing wrong? Note that the tables are related by the pk / fk "screening_cd" TIA
Is the column CODE present in both tables? If so (if you are not getting an error from SQL Server) do you suppose the query optimizer can decide which to choose?
Hi Friends: I found a page in a SQL manual telling me that my field aliases will not work in other parts of the SQL statement except in the Order By Clause (I think), so I guess that's that.
I guess this makes sense as the query will first need to put together the dataset from the information in the from clause, at which point the fields must match their names in the tables. Live and learn...