Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

whereclause based on alias Or columnnumber

Status
Not open for further replies.

DaHapMan

Programmer
Oct 31, 2000
20
0
0
NL
Hi there,

Is it possible to build a where-clause based on column-aliases or based on column-number?

e.g.
SELECT col1 as [column1]
, col2 as [column2]
FROM tblTable
WHERE [column1] = N'%aa%'

OR

SELECT col1 as [column1]
, col2 as [column2]
FROM tblTable
WHERE 1 = N'%aa%'

Hope someone can help me soon.
thnx, DaHapMan
 
Code:
select * from (
SELECT col1 as column1
,      col2 as column2
FROM   tblTable ) dt
WHERE  column1 = N'%aa%'

Using ordinal numbers will never be possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top