| Author |
Topic |
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-12-10 : 04:21:33
|
| HiI know it is possible, but I can't find the right solution for something simple.I have in one collumn following data:Columntest:ManWomanAlien...But i need another collumn that shows me like another name for itso case when columntest = 'man' then othernamewhen columntest = 'woman' then another...Ty :)when |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-10 : 04:28:49
|
| HiUsing CASE...is fine-------------------------R... |
 |
|
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-12-10 : 04:52:10
|
| I tried, but getting errors :/ |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-10 : 04:55:59
|
| HiCan you post the query...It will helpful for us..-------------------------R... |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-10 : 05:02:50
|
HiSyntax is like this..CASE expressionWHEN expression1 THEN expression1[[WHEN expression2 THEN expression2] [...]][ELSE expressionN]END -------------------------R... |
 |
|
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-12-10 : 05:03:17
|
| SELECT *,case when Eng_To_Gps_Modellen.Plant = 'france' then 'fra' when Eng_To_Gps_Modellen.Plant = 'germany' then 'DE'end as MFR,FROM Eng_To_Gps_Modellen LEFT JOIN Model_Matrix_EUNANZLAR ON Model_Matrix_EUNANZLAR.MODEL=Eng_To_Gps_Modellen.GPS_Models; |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-10 : 05:05:58
|
HiTry this..SELECT *, CASE WHEN ENG_TO_GPS_MODELLEN.PLANT = 'FRANCE' THEN 'FRA' WHEN ENG_TO_GPS_MODELLEN.PLANT = 'GERMANY' THEN 'DE' END AS MFRFROM ENG_TO_GPS_MODELLEN LEFT JOIN MODEL_MATRIX_EUNANZLAR ON MODEL_MATRIX_EUNANZLAR.MODEL = ENG_TO_GPS_MODELLEN.GPS_MODELS; -------------------------R... |
 |
|
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-12-10 : 05:25:23
|
| This is why i hate acces! I'm used to work with SQL 2005.He still gives a syntax error(missing operator) in query expression CASE.Is TSQL different from ACCES query? |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-10 : 05:37:26
|
quote: Originally posted by IBoonZ This is why i hate acces! I'm used to work with SQL 2005.He still gives a syntax error(missing operator) in query expression CASE.Is TSQL different from ACCES query?
HIIf you using MS - Access You can use IFF() instead of Case..But you posted in Transact-SQL (2005) thread.. -------------------------R... |
 |
|
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-12-10 : 05:46:53
|
| he, did it in design view, so if other ppl like me have this problem.I did thisCountry: IIf(Eng_To_Gps_Modellen.Plant="German";"de";IIf(Eng_To_Gps_Modellen.Plant="France";"FR";IIf(Eng_To_Gps_Modellen.Plant="Austr";"AS";IIf(Eng_To_Gps_Modellen.Plant="Island";"IL";IIf(Eng_To_Gps_Modellen.Plant="USA";"U";"No country")))))And Ty for the help :D |
 |
|
|
|