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