Results 1 to 2 of 2
Thread: SQL String Writer
Sep 19, 2003, 10:00 #1
- Join Date
- Jul 2003
- Genoa, OH
- 0 Post(s)
- 0 Thread(s)
SQL String Questions
I want to do some logic in a SQL string that is retrieving just 5 columns or so from a table. I currently have it creating expressions for each used column so it looks readable on a webpage, but I need some more.
I would like to have it return a string based on teh value of a field. For Example, I have a "ship_to" field with numbers. So I would like it to return "Client" when the number is 1. How can I do this?
Here is the string I have so far:
SELECT [Date] AS Date, CLrace AS Demographic, Bro_type AS [Brochure Type], Bro_NAME AS [Brochure Name], numcopies AS [Number of Copies]
WHERE (Sequence = 9)
I know there are other ways I could deal with teh data, but if I could do everything in the SQL string that would help me.
Sep 19, 2003, 15:07 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 63 Post(s)
- 3 Thread(s)
" ... if I could do everything in the SQL string ..."
that's the way i look at things, too
based on the fact that you're using square brackets to escape your use of reserved words as column names, i'd say you were using microsoft access, so this is what you want --
select IIF(shipto=1,"Client","notClient") as IsShipToClient
in other databases, use CASE structure instead of IIF function