If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Today Function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-06, 10:00
dbatlanta dbatlanta is offline
Registered User
 
Join Date: Dec 2005
Posts: 11
Today Function

Hi All,

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.


select a.txn_dt
from sales a, systables b
where a.yearmonth >=200601
and a.txn_dt between today -7 and today -1

This has 15964326 rowcount


select txn_dt
from sales
where yearmonth >=200601
and txn_dt between today -7 and today -1

This has 126701 rowcount


Thank you all for your help.
Reply With Quote
  #2 (permalink)  
Old 01-27-06, 10:04
nitin_math nitin_math is offline
Registered User
 
Join Date: Nov 2004
Posts: 143
Hello,

In your first query you have not given any join condition betwn sales and systables, so should expect the AxB resultset.

Bye

Nitin
Reply With Quote
  #3 (permalink)  
Old 01-27-06, 10:36
dbatlanta dbatlanta is offline
Registered User
 
Join Date: Dec 2005
Posts: 11
Hi Nitin,

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.

Thank you again.
Reply With Quote
  #4 (permalink)  
Old 01-27-06, 11:43
nitin_math nitin_math is offline
Registered User
 
Join Date: Nov 2004
Posts: 143
Hello,

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.

Bye

Nitin
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On