Issue with OLE DB Query - Date Search

D

Dawn Smith

Hi everyone,

I currently have the below code which unfortunately for me means I need to update 2 dates (Last Updated dates). This is changed depending on when I alst ran it. The reason I have this is because it is pulling data back from adatabase but needs to search in 2 places for this (they have different "TYPE" fields). At the moment I can only get it to bring back data for both byhaving a date search for both of them also. If I just have one at the end of the queryit searches for ALL CERPS BI and only filters the CERPS by the dates. I'm sure I just need to move some brackets around somewhere but I can't figure it out. Any help is MUCH appreciated

1) TYPE = 'INFORMATION ANALYSIS APP' AND (CATEGORY = 'CERPS BI')
2) TYPE = 'MANUFACT AND SUPPLY CHAIN' AND (CATEGORY = 'BEBOP' OR CATEGORY = 'CERPS' OR CATEGORY = 'ICERPS' OR CATEGORY = 'JCERPS' OR CATEGORY = 'MERPS' OR CATEGORY = 'MERPS2' OR CATEGORY = 'STIEFEL SAP' OR CATEGORY = 'MOD CF')

from ARAdmin.GSK_INCIDENT where TYPE = 'INFORMATION ANALYSIS APP' AND (CATEGORY = 'CERPS BI') AND ((TO_DATE(TO_DATE('01/01/1970 00:00:00','MM/DD/YYYY HH24:MI:SS') + ((LAST_UPDATED)/(86400)), 'DD/MM/YYYY HH24:MI:SS')) BETWEEN TO_DATE('13/11/2012 23:59:59','DD/MM/YYYY HH24:MI:SS') AND TO_DATE('14/11/2012 23:59:59','DD/MM/YYYY HH24:MI:SS') ) OR TYPE = 'MANUFACT AND SUPPLY CHAIN' AND (CATEGORY = 'BEBOP' OR CATEGORY = 'CERPS' OR CATEGORY ='ICERPS' OR CATEGORY = 'JCERPS' OR CATEGORY = 'MERPS' OR CATEGORY = 'MERPS2' OR CATEGORY = 'STIEFEL SAP' OR CATEGORY = 'MOD CF') AND ((TO_DATE(TO_DATE('01/01/1970 00:00:00','MM/DD/YYYY HH24:MI:SS') + ((LAST_UPDATED)/(86400)), 'DD/MM/YYYY HH24:MI:SS')) BETWEEN TO_DATE('13/11/2012 23:59:59','DD/MM/YYYY HH24:MI:SS') AND TO_DATE('14/11/2012 23:59:59','DD/MM/YYYY HH24:MI:SS') )

Also, as a secondary and less important question, can I just have one date?- i.e search for anything last updated since 14/11/12 for example?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top