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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Date Ranges from Data 3

Status
Not open for further replies.

MikeAuz1979

Programmer
Aug 28, 2006
80
AU
Hi,

Using Access 2000 I have table data like:

Site Month MDQ
1005 01-jan-01 100
1005 01-feb-01 100
1005 01-mar-01 200
1005 01-apr-01 200

Is there any way to convert this into a result like:
(I.e. To convert it from actual monthly data into MDQ ranges)

Site StartDate EndDate MDQ
1005 01-jan-01 28-feb-01 100
1005 01-mar-01 30-Apr-01 200

Thanks for any help
Mike
 
This should work for your example data:
Code:
SELECT Site, MDQ, Min([Month]) as StartDate, DateAdd("m",1,[Month])-1 as EndDate
FROM [data like]
GROUP BY Site, MDQ;
Can't even guess how it will handle more data.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Good catch. Thanks.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
hard to pick who gets the star
Obviously BOTH !
 
Anyone who cleans up after me deserves a star ;-)

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Hi,

I gave rudy a star as well.

Erm - do I get a star for cleaning up after Mike (in that Mike should have given rudy a star)? [wink]

atb

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top