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 |
|
kashyapsid
Yak Posting Veteran
78 Posts |
Posted - 2010-04-23 : 03:41:33
|
| i have a table in that a column name is modified.date the table name is orderdetails. i want to known the last dates of the column modified.datejust i want the output for each customer orders placed on the customer's last day of activity in every month my desired out must be like thiscustid Modifieddate ----------- ----------------------- 1 2008-04-09 00:00:00.000 2 2008-03-04 00:00:00.000 3 2008-01-28 00:00:00.000 4 2008-04-10 00:00:00.000 5 2008-03-04 00:00:00.000 87 2008-04-15 00:00:00.000 88 2008-03-09 00:00:00.000 89 2008-05-01 00:00:00.000 90 2008-04-07 00:00:00.000 91 2008-04-23 00:00:00.000 So please help meKaShYaP |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-23 : 03:50:35
|
[code]select max(MOdifieddate)from yourtable[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 04:00:48
|
shouldnt that be?select custid,max(MOdifieddate)from yourtablegroup by custid ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
kashyapsid
Yak Posting Veteran
78 Posts |
Posted - 2010-04-23 : 06:28:52
|
| No it gives the max value of the date but i want the full data that was entered in the last dates of each month only the last entered data in the month ending please helpKaShYaP |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-04-23 : 06:31:06
|
| [code]select custid,max(MOdifieddate)from yourtablegroup by custid,Datepart(MM,MOdifieddate)[/code]PBUH |
 |
|
|
kashyapsid
Yak Posting Veteran
78 Posts |
Posted - 2010-04-23 : 06:34:36
|
| thanks Mr.Idera it works thanks for consideringKaShYaP |
 |
|
|
|
|
|