Access has a last function available for when you are grouping on a summary level. What this does is return the last record for that particular grouping. Does sql have function of that nature?
Example:
Item_Code Time
123456 11:40
123456 11:41
123456 11:42
By grouping on item code and using the last function on the Time column, the third record would be returned.
Item_Code Time
123456 11:42
All, help is appreciated.Last is not as reliable as you may think, and SQL Server doesn't have it. Try Max instead.|||well, i really cannot use max because it will give me a max each cloumn. For example:
Item Date Time
12345 7/10/06 11:21
12345 7/10/06 11:45
12345 7/12/06 09:45
If i group on item and use max for date and time i would get
Item Date Time
12345 7/12/06 11:45
I basically need to find a way o get the last record of a set.
Maybe there is a better way to approach this.|||Last would not behave any differently in Access, so I'm not sure why you asked for the replacement for Last. One way is to join date and time together in one field and do your max on that.|||Last would not behave any differently in Access, so I'm not sure why you asked for the replacement for Last. One way is to join date and time together in one field and do your max on that.
I think that would probbaly be my best bet. Thanks for all your help.|||No problem. BTW, here's more info on why First/Last are not necessarily reliable anyway:
http://support.microsoft.com/kb/208190/en-us|||No problem. BTW, here's more info on why First/Last are not necessarily reliable anyway:
http://support.microsoft.com/kb/208190/en-us
Sweet, I really appreciate all the help and notes.
No comments:
Post a Comment