Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

SQL Query problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pradeep - 07 May 2007 16:02 GMT
I have a table like below

Date, Qty
1-Jan, 10
2-Jan, 10
3-Jan, 20
4-Jan, 10

I want to write a query to display

Date_interval, qty
1-Jan to 2-jan, 10
3-Jan to 3-jan, 20
4-jan to 4-jan, 10 <-- seperate row for 4-jan even though the Qty is
same

I tried by grouping on Qty from which I get

Qty, Min(date),Max(date)
10, 1-Jan, 4-jan
20, 2-Jan, 2-jan  <-- no seperate row for 4-jan

Please help me in getting that extra row of 4-jan

Thanks
Pradeep
John W. Vinson - 07 May 2007 20:45 GMT
>I have a table like below
>
[quoted text clipped - 22 lines]
>Thanks
>Pradeep

I don't understand the logic here, Pradeep. Why does 4 Jan qualify for a
separate row? What is the "trigger" for going to a new row - a change in Qty,
or what?

            John W. Vinson [MVP]
Pradeep - 08 May 2007 04:54 GMT
On 8 May, 00:45, John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com>
wrote:

> >I have a table like below
>
[quoted text clipped - 30 lines]
>
> - Show quoted text -

The trigger to this request is that a letter is to be printed, the
contents of which should be,
Date               Del
1-Jan to 2-jan  10
3-Jan to 3-Jan  20
4-jan to 4-Jan   10

i.e. any break in the del. qty has to be seperate. If i group on qty i
get

Date               Del
1-Jan to 4-jan  10
3-Jan to 3-Jan  20

Above is confusing for the party to which the letter needs to be sent.

I hope my request is logical. I can do this with VBA (by populating a
dummy table) but just wanted to check whether a SQL query can be
written for this.

Thanks

Pradeep
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.