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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Join tables on concatenated field

Author  Topic 

mj
Starting Member

25 Posts

Posted - 2002-06-05 : 10:04:29
I have a query i am trying to perform that joins a field from table a on a aliased (concatenated) field from table b. When I try to execute, I get "Invalid Column Name: (column name)"

Here is my query:

SELECT dbo.tableb.field1+ dbo.tableb.field2 AS AliasedField
FROM dbo.tableA INNER JOIN
dbo.tableb ON dbo.tablea.field1 = dbo.tableb.AliasedField.

Is there somewhere I can research how to do this, or does someone know how to do a join on an aliased field.

Thanks in advance

mj

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-06-05 : 10:18:05
quote:

Is there somewhere I can research how to do this, or does someone know how to do a join on an aliased field.



prepare to smack yourself on the forehead . . .

SELECT dbo.tableb.field1+ dbo.tableb.field2 AS AliasedField
FROM dbo.tableA INNER JOIN
dbo.tableb ON dbo.tablea.field1 = dbo.tableb.field1+ dbo.tableb.field2

 


<O>
Go to Top of Page

mj
Starting Member

25 Posts

Posted - 2002-06-05 : 10:28:37
Yep, found that out right after i clicked submit. thanks for your help

Go to Top of Page
   

- Advertisement -