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 |
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2011-08-17 : 09:28:27
|
Hi,I would like to get the MAX requestdate.There are couple of records but I need only the Max requestdate.Best Regardshere is the sample statement:select RequestDate,Vendor,Item from Table1 where vendor = '1' and Item = 1 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-17 : 09:35:18
|
just the requestdate ?select max(requestdate)from Table1 KH[spoiler]Time is always against us[/spoiler] |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2011-08-17 : 09:40:20
|
Nope I need the max requestdate with vendor and item also but I need only 1 record. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-17 : 09:50:57
|
[code]select top 1 *from Table1order by requestdate desc[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-17 : 09:51:08
|
do u mean this? if not post your expected output for a sample dataselect vendor ,item ,max(requestdate)from Table1group by vendor ,item ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2011-08-17 : 09:53:12
|
khtan's reply is what I want. It produces only one result. visakh16, your reply brings more than one result.Thanks everybody. |
|
|
|
|
|