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 |
marek
Starting Member
34 Posts |
Posted - 2011-05-12 : 03:52:15
|
I have following problem....I find in this forum, but "case" not working.TabBranchbranch employe100 Bill100 George200 Mark300 Bruce300 WillisresultWashington BillWashington GeorgeDallas MarkChicago BruceChicago WillisWhere I have eror?Select branch case branch when '100' then 'Washington'case branch when '200' then 'Dallas'case branch when '300' then 'Chicago'thanks boys... |
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-05-12 : 03:58:32
|
CREATE TABLE #TabBranch (branch INT, employe VARCHAR(50))INSERT INTO #TabBranch SELECT 100, 'Bill' UNION ALLSELECT 100, 'George' UNION ALLSELECT 200, 'Mark' UNION ALLSELECT 300, 'Bruce' UNION ALLSELECT 300, 'Willis' SELECT CASE branch WHEN 100 THEN 'Washington' WHEN 200 THEN 'Dallas' WHEN 300 THEN 'Chicago' ELSE '' END AS branch, employe FROM #TabBranchDROP TABLE #TabBranch--------------------------http://connectsql.blogspot.com/ |
 |
|
marek
Starting Member
34 Posts |
Posted - 2011-05-12 : 05:52:38
|
thanks lionofdezert |
 |
|
|
|
|