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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-11-03 : 00:58:40
|
Hi all,I have 2 column ID and Date ID |date 1 |2011-10-26 23:59:18.0001 |2011-10-27 00:06:31.0001 |2011-10-27 03:02:57.0002 |2011-09-27 03:02:57.0003 |2011-11-01 00:49:12.0003 |2011-11-02 23:16:53.000I need to select distinct record of ID which is latest based on Date column.Result:ID |date 1 |2011-10-27 03:02:57.0002 |2011-09-27 03:02:57.0003 |2011-11-02 23:16:53.000Thanks,Gangadhara MSSQL Developer and DBA |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-11-03 : 01:44:36
|
Hi Tara,Thanks for the response,actually one more fields also there sameple is here ID |date | ssemail1 |2011-10-26 23:59:18.000 |a@tt.com1 |2011-10-27 00:06:31.000 |b@tt.com1 |2011-10-27 03:02:57.000 |c@tt.com2 |2011-09-27 03:02:57.000 |d@tt.com3 |2011-11-01 00:49:12.000 |e@tt.com3 |2011-11-02 23:16:53.000 |f@tt.comResult ID |date | ssemail1 |2011-10-27 03:02:57.000 |c@tt.com2 |2011-09-27 03:02:57.000 |d@tt.com3 |2011-11-02 23:16:53.000 |f@tt.comwhen i used above query without ssemail i am gettign correct answer, with ssemail field i am getting wrong result setpls helpThanks,Gangadhara MSSQL Developer and DBA |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-11-03 : 02:32:50
|
i am not much into development could somebody pls help me Thanks,Gangadhara MSSQL Developer and DBA |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|