StealthRT
StealthRT

Reputation: 10542

Query on a AS tablename in Oracle 10g

Hey all, how can i go about query off a made AS Tablename in a query of mine?

(its a long query so i have shortened it to the needed lines for this example)

SELECT 
TO_CHAR(SYSDATE, 'YYYYMMDD') AS CURDATE, 
TO_CHAR(A.DUE_DATE, 'YYYYMMDD') AS DUE, 
UGRP.GROUP_CODE AS UGRPCODE, 
A.DETAILS, 
TRIM(STF.IDENTIFIER_1) || ', ' || TRIM(STF.IDENTIFIER_2) || ' ' || TRIM(STF.IDENTIFIER_3)     AS STAFF, 
FROM REC.CUSTOM_ATTRIBUTES E 
INNER JOIN REC.SERVICE_REQUESTS SR 
INNER JOIN REC.IDENTIFIERS STF ON A.ASSIGNED_STAFF_EID = STF.OWNER_EID ON E.OWNER_EID =     SR.EID 
WHERE (TYP.TYPE_CODE = 'SRSRTYPE') 
AND (A.ASSIGNED_STAFF_EID <> 2000478) 
AND STAFF = 'BARKER, BOB' 
ORDER BY  SR.SERVICE_REQUEST_NUM

Naturally the AND STAFF = 'BARKER, BOB" will not work for me.

My question is how can I query on that column?

Thanks!

David

Upvotes: 0

Views: 127

Answers (1)

Joe Stefanelli
Joe Stefanelli

Reputation: 135808

Repeat the formula in your WHERE clause.

... AND TRIM(STF.IDENTIFIER_1) || ', ' || TRIM(STF.IDENTIFIER_2) || ' ' || TRIM(STF.IDENTIFIER_3) = 'BARKER, BOB' ...

Upvotes: 2

Related Questions