Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kcarbone1970
Yak Posting Veteran
52 Posts |
Posted - 2015-03-31 : 12:49:52
|
I keep getting invalid column ?? abcSELECT CAST(c.CountyCode AS VARCHAR(2)) + CAST(c.DistrictCode AS VARCHAR(10)) + CAST(c.SchoolCode AS VARCHAR(12)) AS abcFROM CAHSEE2014new c INNER JOIN CDS a ON abc = a.CDSCODE Cartesian Yak |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-03-31 : 13:19:03
|
You can't use an alias until the order by clause. here's one easy way around it.select abcfrom CAHSEE2014new ccross apply( select CAST(c.CountryCode AS VARCHAR(2)) + CAST(c.DistrictCode AS VARCHAR(10)) + CAST(c.SchoolCode AS VARCHAR(12)) AS abc) _INNER JOIN CDS a ON abc = a.CDSCODE |
|
|
kcarbone1970
Yak Posting Veteran
52 Posts |
Posted - 2015-04-01 : 13:39:42
|
Thank You!Cartesian Yak |
|
|
|
|
|