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 |
nokiauk
Starting Member
9 Posts |
Posted - 2012-06-18 : 04:42:02
|
HiI've got a SQL report that has various columns the 2 that are important here are :Person.Gender AgeI need a statement (case or if) in my where clause that can accomplish the following:I only want to return rows when if the Person.Gender is Male and under is under 65 and if Person.Gender is Female and age is under 61.Not sure how to utilize the 2 columns?Thanks |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2012-06-18 : 04:49:59
|
You can try some thing like thisSelect * from table_name where (gender='male' and age<65) or (gender='female' and age<61)Senthil Kumar C------------------------------------------------------MCITP - Database Administration SQL SERVER 2008MCTS - Database Development SQL SERVER 2008 |
|
|
|
|
|