Re: SYSDATE query

From: Bradley Crockett <bcrockett_at_altavista.net>
Date: Mon, 08 Oct 2001 14:05:36 GMT
Message-ID: <Qoiw7.55551$L8.16609280_at_news2.rdc1.bc.home.com>


Using ROUND would likely not work for you. TRUNC could give you the transactions from a calendar month -- is that what you want? For instance, if today is October 8th, do you want all of the transactions from October 1st through 8th?

If it's actually the transactions from September 8th through October 8th that you want, try a simple subtraction from SYSDATE:

WHERE cash_ledger_id = 'NAMS1001'
AND transaction_date >= SYSDATE - 31;

Bradley Crockett

In article <e5f19d69.0110080131.4bd36ecb_at_posting.google.com>, cvanhilten_at_hotmail.com says...
>
>(running Oracle 8i release 8.1.6.0.0)
>
>I have a query that extracts certain information from a list of cash
>account transactions. I would like to amend the query to select only
>those transactions where transaction_date was in the last 31 days. I
>have seen some examples on the internet that talk about using
>round(sysdate), but still cannot get my query to work.
>
>I would be very grateful for any help with the query, which reads as
>follows:
>
>
>SELECT cash_transaction_id, cash_ledger_id, cash_amount,
>to_char(transaction_date, 'DD-MM-YY') as transaction_date
>FROM webcentre_t_cash_dealing
>WHERE cash_ledger_id = 'NAMS1001'
>
>
>Thank you.
>
>Clive van Hilten
Received on Mon Oct 08 2001 - 16:05:36 CEST

Original text of this message