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

Sql Syntax conversion for a report formula 1

Status
Not open for further replies.

Jcfx

MIS
Oct 8, 2004
134
US
I am converting some crystal reports over to reporting services and have to have some of the formulas results done on the sql side.

what would be my syntax for the following conditional statement?
//@Location
if {stops.stp_event} = "LLD" and {stops.stp_status} = "OPN" then "On Way"
Else
if {stops.stp_event} = "LLD" and {stops.stp_status} = "DNE" then "Romulus"
Else
if {stops.stp_event} = "HCT" and {stops.stp_status} = "DNE" then "Woodstock"


Thank you






Julie
CRXI CE10 / RS2005 Sql DB
 
Take a look at CASE statement in Books Online. Here is a link on msdn.

The query would look like this
Code:
SELECT 
CASE 
WHEN stops.stp_event = 'LLD' and stops.stp_status = 'OPN' then 'On Way'
WHEN stops.stp_event = 'LLD' and stops.stp_status = 'DNE' then 'Romulus'
WHEN stops.stp_event = 'HCT' and stops.stp_status = 'DNE' then 'Woodstock'
END
FROM TBL

Sunil
 
Thank you

I've seen a couple different ways to format case and wasnt sure of the standard.

Appreciate the assistance.

Julie
CRXI CE10 / RS2005 Sql DB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top