Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group By (on Change) Qustion

Status
Not open for further replies.

PWise

Programmer
Dec 12, 2002
2,633
US
This is my data

Date Place
1/1/8 Home
1/2/8 Home
1/5/8 Home
.... Home
1/15/8 Home
1/20/8 School
1/21/8 School
... School
1/25/8 School
1/27/8 Home
1/31/8 Home

I would like it displayed like this

StartDate EndDate Place
1/1/8 1/15/8 Home
1/20/8 1/25/8 School
1/27/8 1/31/8 Home

Any Help will be appreciated
 
Hello

Code:
SELECT MIN (Date) AS StartDate,
       MAX (Date) AS EndDate,
       Place

FROM   YOURTABLE

GROUP BY Place

Hope this helps :)
 
Oops, sorry, didn't see the second home grouping, that will teach me to read more carefully before I post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top