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 |
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2011-05-10 : 07:06:07
|
Hi, I want to add a condition to my select query but I dont know how to do it any help please.. The select query isselect * from dbo.PatientData_151where tod is null and regstat <> '99' Now, I have a field called yob (year of birth) which on the table is for example 153, but to get the exact yob = 153 + 1800 = 1953Now I have another field called lcd which is static as 2010. I want to include the condition; if the yob (please add 1800 to yob to make it the exact yob) is more than a 115 years prior to the lcd - output resultThanks |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-05-10 : 07:14:54
|
| select * from dbo.PatientData_151where tod is null and regstat <> '99'AND lcd-(yob+1800)>115--------------------------http://connectsql.blogspot.com/ |
 |
|
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2011-05-10 : 07:20:13
|
| thanks |
 |
|
|
|
|
|