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 |
|
voyager838
Yak Posting Veteran
90 Posts |
Posted - 2009-05-10 : 02:50:06
|
| Hi!I have a serious problem, that i don't find a solution for.I have tried.This is the main table LogTime A B C D E2008-10-10 00:00:00 11 2 2 3 3 2008-10-10 01:00:00 1 NULL 15 12 7 2008-10-10 02:00:00 9 5 7 NULL 3 2008-10-10 03:00:00 13 2 15 12 1 I want now to take out every columndata and letis satisfying the condition ">10" for column A,B and C and "<5" for column D and ESo the result would look like thisLogTime A B C D E2008-10-10 00:00:00 11 NULL NULL NULL NULL 2008-10-10 01:00:00 NULL NULL 15 12 7 2008-10-10 02:00:00 NULL NULL NULL NULL NULL 2008-10-10 03:00:00 13 NULL 15 12 NULLMost gratefull |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-10 : 03:26:42
|
| [code]UPDATE YourTableSET A=CASE WHEN A-10 > 0 THEN A ELSE NULL END,B=CASE WHEN B-10 > 0 THEN B ELSE NULL END,C=CASE WHEN C-10 > 0 THEN C ELSE NULL END,D=CASE WHEN D-5 > 0 THEN D ELSE NULL END,E=CASE WHEN E-5 > 0 THEN E ELSE NULL END[/code] |
 |
|
|
voyager838
Yak Posting Veteran
90 Posts |
Posted - 2009-05-10 : 04:02:05
|
| Thanks visakh16!That seems to work perfectly. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-10 : 05:04:59
|
welcome |
 |
|
|
|
|
|