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 |
asimonse
Starting Member
4 Posts |
Posted - 2003-10-02 : 07:43:48
|
I wan't to make a query as follow:Source Table:Column_A12345Query result:Column_A | Column_B1 | 02 | 13 | 14 | 15 | 0Add a column in the query result. For all the values form Column_A between 2 and 5 set the value in Column_B to value "1". All the other values should be value "0".such as (but this query doesn't work in MS Access or VB):SELECT Column_A,case when Column_A between 2 and 4 then 1 else 0 end as column_b FROM Mytable |
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-02 : 08:31:46
|
SELECT Column_A,iif(Column_A >= 2 and Column_A <= 4, 1, 0) as column_b FROM Mytable |
 |
|
asimonse
Starting Member
4 Posts |
Posted - 2003-10-02 : 09:42:31
|
Perfect, it works! |
 |
|
|
|
|