Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to force date minus date function to be processed on server ?

Status
Not open for further replies.

cogprog

Programmer
Jul 17, 2002
24
US
I am trying to create a join between two database tables in a catalog to create a summary report. Join is something like

( where (A.DATE1-A.DATE2) Between B.Range1))

First of all I had a problems in having date minus date operation. Then I applied date-to-days-1900(date_exp)in both dates. It worked. Now down under impromptu is bringing both the tables to the client and then doing join on the client rather than the server. Which is major setback to query performance.
Then I removed the join and created the range (date minus date ) using date-to-days-1900 function. It does not show me the range variable at all in the SQL query(profile tab under query) but it shows it in the IQD. That means IQD contains local processed query because I am using date-to-days-1900 function which is completely impromptu function. Is there any way to force date minus date function to precess on the database itself. I am using Teradata and It is having date minus date function to give me integer as output.

 
Hello,

You can take one date from another date and return the number of months between the two dates. I did this in SQL
(((YEAR(TO_DATE(DATE,'%Y%m')) - YEAR(TO_DATE(DATE,'%d%m%Y')))*12 + MONTH(TO_DATE(DATE,'%Y%m'))) - MONTH(TO_DATE(DATE,'%d%m%Y')))

This will give you the number of months between. Look at the different fuctions here "YEAR" "TO_DATE" etc and apply them in Impromptu


Can_he

 
Hello,
You can also get the days like :

( EXTEND(TO_DATE(Date,'%Y%m%d'), YEAR TO FRACTION) - TO_DATE(Date,'%d%m%Y') ) c4
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top