|
select sum(ilneprice) suma, case when ilninvdate between '02/01/2005' and '10/31/2005' then 1 when ilninvdate between '11/01/2005' and '11/30/2005' then 2 ... else 0 end as period from... where.. group by period You will get a row for each period. __________________________________________________________________________ Douglas W. Palme wrote:
Its been a few weeks since I last posted, and its been a over a week since I was even at work....actually I kind of missed a lot of you :) Trying to get some rest and recoup time in a hospital bed just does not seem to ever work.Alas, I am back, working on another stupid SQL problem. If someone could point me in the right direction on this I would appreciate it.I need to extract a sum of our line items for two separate date ranges, IE: select sum(ilneprice) as current from speclf where ilninvdate >'02/01/2005' and ilninvdate <='10/31/2005'That works just fine, but I also need to extract a sum for the same field (ilneprice) for a different date range....is it possible to do this without having to run the query two separate times? Because I also need to extract some other information and group it by location codes and item numbers....Any help would be appreciated. Douglas If you bought it, it was hauled by a truck - somewhere, sometime.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.