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 |
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2014-02-11 : 21:25:25
|
Hi friends,I have a table with the following fieldsCustomerType Customer_ScoreDaily 1Regular 0Weekly 3What i basically want to do is that i want to select the data from the above table and show the result in the following wayCustomerType Absent Weak Strong Moderate Daily 1 Regular 0 Weekly 3how i determine is that i already have a predefined rulethe daly customer has folowing rule 0-absent 1-weak 2-strong 2.5-Moderateweekly customer has the follwoing rule 0-absent 1-weak 2-strng 3-ModerateHope my question is clear..For each customertype there is a predefined numeric to determine the frequencytype and i wnat to split them in that colums.Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-12 : 00:27:25
|
[code]SELECT CustomerType,CASE Customer_Score WHEN 0THEN Customer_Score END AS Absent,CASE Customer_Score WHEN 1THEN Customer_Score END AS Weak,CASE Customer_Score WHEN 2THEN Customer_Score END AS Strong,CASE WHEN ((Customer_Score = 2.5 AND CustomerType = 'Daily')OR (Customer_Score = 3 AND CustomerType = 'Weekly'))THEN Customer_Score END AS ModerateFROM Table[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2014-02-12 : 11:14:41
|
Thank you visakh16 that got me started. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-13 : 08:09:29
|
cool------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|