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 |
|
Oli4
Starting Member
4 Posts |
Posted - 2010-10-01 : 03:05:15
|
| Hey I'm very new in using SQL. I'm learning for the second week now.I have to make a couple of exercises, but I'm struggling with some exceptions. I'm using SQL server management studio and MSQL server express.I have a database called library and I have to put old or new next to the books from before or after 1980.I already tried different things myself. Like this one:Select title, year, test = case yearwhen year is > 1980 then 'new'else 'old'endfrom BOEKENIt's important to me to understand what I'm doing wrong, I get a syntax error near >Can somebody explain if this is the right option and if working with the case function is nescessary.I haven't learned anything about if then, or other programming structures yet. thxHere today, gone tomorrow |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-10-01 : 03:19:42
|
[code]Select title, year, test = case yearwhen year is > 1980 then 'new'else 'old'endfrom BOEKEN[/code]PBUH |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-01 : 03:21:58
|
quote: Originally posted by Oli4 Hey I'm very new in using SQL. I'm learning for the second week now.I have to make a couple of exercises, but I'm struggling with some exceptions. I'm using SQL server management studio and MSQL server express.I have a database called library and I have to put old or new next to the books from before or after 1980.I already tried different things myself. Like this one:Select title, year, test = case yearwhen year is > 1980 then 'new'else 'old'endfrom BOEKENIt's important to me to understand what I'm doing wrong, I get a syntax error near >Can somebody explain if this is the right option and if working with the case function is nescessary.I haven't learned anything about if then, or other programming structures yet. thxHere today, gone tomorrow
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-01 : 03:22:33
|
 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Oli4
Starting Member
4 Posts |
Posted - 2010-10-01 : 07:54:46
|
| Thanks for the answer.Here today, gone tomorrow |
 |
|
|
|
|
|
|
|