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

Naming a select case statement as a field name

Status
Not open for further replies.

satinsilhouette

Instructor
Feb 21, 2006
625
Hi I need to name this case statement as a field in a query:

SELECT CASE WHEN ACMNTHDR.DFLT_ACCT_UNIT = ' ' THEN ACACTIVITY.ACCT_UNIT ELSE ACMNTHDR.DFLT_ACCT_UNIT END
FROM ACMNTHDR INNER JOIN
LAW9.ACACTIVITY ON ACMNTHDR.REV_ACTIVITY = ACACTIVITY.ACTIVITY

When I do this
(SELECT CASE WHEN LAW9.ACMNTHDR.DFLT_ACCT_UNIT = ' ' THEN LAW9.ACACTIVITY.ACCT_UNIT ELSE LAW9.ACMNTHDR.DFLT_ACCT_UNIT END
FROM LAW9.ACMNTHDR INNER JOIN
LAW9.ACACTIVITY ON LAW9.ACMNTHDR.REV_ACTIVITY = LAW9.ACACTIVITY.ACTIVITY) AS ACCT I get an error back.

Thanks so much!
satinsilhouette
 
Code:
SELECT     CASE WHEN ACMNTHDR.DFLT_ACCT_UNIT = ' ' THEN ACACTIVITY.ACCT_UNIT ELSE ACMNTHDR.DFLT_ACCT_UNIT END [!]As WhateverYouWant[/!]
FROM         ACMNTHDR INNER JOIN
                      LAW9.ACACTIVITY ON ACMNTHDR.REV_ACTIVITY = ACACTIVITY.ACTIVITY

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I see you have to suffer through the Lawson database, too... is it on Oracle or SQL Server?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top