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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field alias in Where statement

Status
Not open for further replies.

bjornagin

Programmer
Dec 28, 2005
9
US
This should be a simple question.

I'm trying a query like:

SELECT Distinct Left(AuditNum, 4) AS Blah
FROM Audit
where Blah = 'Fred'

When I attempt to execute the query I get prompted for a parameter value "Blah".

Can't I use a field alias in my where clause?

Thanks
 
That would not work. It would work if you had this in another query or table and then referenced it, but not in the same query. you would have to do it like this:

Code:
ECT Distinct Left(AuditNum, 4) AS Blah
FROM Audit
where Left(AuditNum, 4) = 'Fred'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top