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 |
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2011-01-26 : 11:31:58
|
| Hi everyone.working on a members dbI am trying to select members from with two start dates. But only want to retreive the latest date.ieSELECT (INDIVIDUAL_REF), max(valid_from)FROM dbo.s_AttributeWHERE (ATTR_CODE_REF = 3401)and valid_to is nullgroup by (INDIVIDUAL_REF), max(valid_from)order by (INDIVIDUAL_REF)not sure where iam going wrongMCTS / MCITP certified |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-26 : 11:34:00
|
you mean this?SELECT (INDIVIDUAL_REF), max(valid_from)FROM dbo.s_AttributeWHERE (ATTR_CODE_REF = 3401)and valid_to is nullgroup by (INDIVIDUAL_REF)order by (INDIVIDUAL_REF) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2011-01-26 : 11:37:35
|
| thank you for that. but ive managed to suss it out.And i came up with exactly the same syntaxBut thank you very much |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-26 : 11:39:05
|
np ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|