Jump to content

decode or Switch function help.


Guest Marty

Recommended Posts

Hi all,I have the following statement:Select NONAME, "BLM CONSOLIDATED", "BLM HOLDINGS LIMITED", "BLM AZURE LIMITED", "BLM CLILVERD LIMITED", "BLM RED LIMITED", "BOOTH LOCKETT MAKIN LIMITED", "COLUMBUS MEDIA INTERNATIONAL LIMITED", "FLINT CREATIVE SOLUTIONS LIMITED", "QUANTUM NEW MEDIA SERVICES LIMITED" from offline.txtThe 1st column (NODATA) is a list of clients, the others are companies and were they intersect in the grid of data are figures. The grid of data consists of zeros (0) and numbers greater and 1 and numbers less than -1.I would like to replace all data numbers greater and less than 0 with "Yes" and anything zero (0) by "No".I have tried both the switch and decode function but I’m sure my syntax is incorrect. PLEASE can you help me urgently?

Link to comment
Share on other sites

You need the CASE statement. It work like this:SELECT NoName, CASE WHEN BLM_CONSOLIDATED=0 THEN 'No' ELSE 'Yes' END , CASE WHEN BLM_HOLDING_LIMITED=0 THEN 'No' ELSE 'Yes' END , etc...You need a case statement for each column.It's long-winded but it is in the standard and has been implement on most SQL platforms.For Access use the IIF functionIIF([bLM CONSOLIDATED]=0,'No','Yes')

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...