I am using today function to get today -7 and today -1.
My query works But I am getting a different rowcount (the rowcount is pretty huge) when I select it from systables and when I don't. Do I have to include systables in the query or not. Will my logic work if I don't include the systables in the query, or do I have to include it.
from sales a, systables b
where a.yearmonth >=200601
and a.txn_dt between today -7 and today -1
This has 15964326 rowcount
where yearmonth >=200601
and txn_dt between today -7 and today -1
I didn't clearly understand. Should I need to put the join condition or not. could you specify more on it. Thank you so much.
I want txn_dt which is between sysdate-7 and sysdate -1, everytime I run it on Sunday, so that it will grab data for one week, and so that I don't have to keep on putting new dates every week I run the query.
You dont need to systables into the query. There is no need for that. What you want is achievable from the 2nd query.
The logic of 1st query is not correct, so it is given wrong count,thats what I meant.