You are here: USING 'CASE' TO GROUP DATA « MsSQL Server « IT news, forums, messages
USING 'CASE' TO GROUP DATA

Posted by PB on 08/22/06 08:19

Hi,

Can anyone please help me with SQL syntax to create a second variable
based on the value of another (both numeric)?

My effort is below but I get a syntax error.

SELECT

charA,

CASE charA
WHEN < -199 THEN 2
WHEN < 31 THEN 3
WHEN < 82 THEN 4
WHEN < 100 THEN 5
WHEN < 105 THEN 6
WHEN < 111 THEN 7
WHEN < 143 THEN 8
WHEN < 165 THEN 9
WHEN < 233 THEN 10
WHEN >= 233 THEN 11
END AS Bin_charA

FROM X


Server: Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near '<'.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация