sql question

From: Mick Cooke <bridgend-it_at_pavilion.co.uk>
Date: Wed, 1 Dec 1999 11:43:46 -0000
Message-ID: <8231hg$30fg$1_at_grind.server.pavilion.net>



[Quoted] [Quoted] I am having trouble with date function in a query. [Quoted] [Quoted] I want to generate a query that will sumall transactions for the previous month.

e.g.
[Quoted] select a.field1, sum(a.field2), b.field1,b.field2 from table a, table b
where a.field1= b.field3
[Quoted] [Quoted] and a.transaction_date = [this is the problem bit] month -1 group by b.generic_text,a.ACCOUNT_TYPE_CODE,b.long_name

this runs ok when selecting specific number of days e.g

select a.field1, sum(a.field2), b.field1,b.field2 from table a, table b
where a.field1= b.field3
and a.transaction_date = between trunc(sysdate) and trunc(sysdate -1) group by b.generic_text,a.ACCOUNT_TYPE_CODE,b.long_name

I'm sure this is an easy one for someone

thankyou in anticipation and appreciation

Mickc Received on Wed Dec 01 1999 - 12:43:46 CET

Original text of this message