ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Issue with OLE DB Query - Date Search (https://www.excelbanter.com/excel-programming/447656-issue-ole-db-query-date-search.html)

D4WNO

Issue with OLE DB Query - Date Search
 
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 a database 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 by having 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?

D4WNO

Anyone? Any help at all or a pointer in the right direction would be so helpful

D4WNO

Could anyone point me in the right direction please? I've been searching for a few days now

Living the Dream

Issue with OLE DB Query - Date Search
 
Hi

Not sure if you're aware, and it could be why nobody has responded to
your question is that this is an Excel Newsgroup.

You could try Microsoft.Public.Access.Queries as they are more attuned
to OLE DB questions.

HTH
Mick.


All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com