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 |
|
krish001
Yak Posting Veteran
61 Posts |
Posted - 2010-03-22 : 01:09:04
|
| I need a query where iam usingselect max(column1),column2 from table where column1 <=getdate()by this iam getting a group by error to add column2 but i dont want how to avoid group by |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-03-22 : 01:24:49
|
| Try this!select max_date,b.column2 from(select max(column1) as max_date from table where column1 <=getdate()) ainner join table b on b.column1=a.max_dateSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-22 : 11:43:09
|
may be this?select distinct max(case when column1 <=getdate() then column1 else null end) over (partition by column2),column2 from table ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|