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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2009-06-29 : 09:30:52
|
| In Access VBA, there are "first" or "last" in "Group"For example, SELECT Claims.MEMBID, Last(DATEFROM) AS LastOfDATEFROMFROM Claims GROUP BY MEMBIDHow to code in SQL and doing the same job? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-29 : 09:31:43
|
use min() and max() KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2009-06-29 : 09:31:58
|
| min and max maybe?[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQL or How to sell Used CarsFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-29 : 09:44:59
|
Last is not necessary same as MAX or MIN.select *from (SELECT *, ROW_NUMBER() OVER (PARTITION BY MembID ORDER BY <sequential column here>) AS theFirst,ROW_NUMBER() OVER (PARTITION BY MembID ORDER BY <sequential column here> desc) AS theLastfrom table1) AS dwhere 1 in (thefirst, thelast) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|