Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
DavidatHome
Starting Member
1 Post |
Posted - 2002-03-28 : 17:18:17
|
| Currently have information in a table;Table1-Field1-Field2-Field3-Field4-Field5-Field6I can produce what I want in Access but having difficulties in SQLACCESS QUERYSELECT Field1, Field2, Field3, Field4, Field5, Field6, IIf((Field5 = "Yes" And Field2 = "" And Field3 = ""),"Same","") AS FieldTempFROM Table1SQL QUERYTrying to develop something in a stored procedure. Trying to do the query using T-SQL words like IF, and CASE, but can't seem to bring it all together. Background;Can't change the current table structure. And need to base an export to a text file on this query which needs an additional field (i.e. FieldTemp). Based on the information on Field2 and 3 and 5 as you can see the FieldTemp field value needs to change to "Same" or nothing.Any suggestions? Thank you. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-28 : 17:23:51
|
| SELECT Field1, Field2, Field3, Field4, Field5, Field6, CASE WHEN Field5='Yes' AND Field2='' AND Field3=''THEN 'Same'ELSE ''END AS FieldTemp FROM Table1 |
 |
|
|
|
|
|
|
|