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!

Select column output based on 2 fields

Status
Not open for further replies.

johnisotank

Technical User
Aug 8, 2008
258
GB
Hi,

could someone help with this please..

I have a tblJobs with the following columns

1. JobNo
2. Status
3. InvoiceStatus

I would like to run a select query that says 'If the InvoiceStatus is 'I' then display 'Invoiced' else display the value in the Status box.

So the following jobs...

JobNo, Status, InvoiceStatus
1, Completed, I
2, Completed, C

would output on the query as

JobNo, Status,
1, Invoiced
2, Completed

I'm OK doing CASE statements based on one column but not two!

Hope someone can help

Thanks
John
 
Hi again,

got it!

simple as

Code:
CASE WHEN InvoiceStatus='I' THEN 'Invoiced' ELSE  Status END

didn't work first time due to me not grouping correctly and I immediately thought it needed to be a lot more complicated.

Thanks anyway

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top