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 |
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2007-12-03 : 23:24:29
|
| Hi all,I have a problem for query. I have a table containing PersonID, Date_of_Visit.This table has basically data for each person's all the visits with the date they visited.Now, I need to know only the recent date for each person in the table through query.How can I get that.. So, output will be something like this:PersonID RecentVisit1 29-Sep-20072 30-OCT-20073 10-July-2007... and so on.Thanks,Ujjaval |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2007-12-03 : 23:47:08
|
| select personid, max(date_of_visit) as recentVisit from <yourTable> group by personidBe One with the OptimizerTG |
 |
|
|
|
|
|