LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 12
Default 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?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL Query Issue John Excel Programming 0 December 9th 08 03:35 PM
Help with search and copy issue Mekinnik Excel Programming 0 January 9th 08 08:21 PM
Search and replace issue pickwickian Excel Discussion (Misc queries) 2 June 22nd 07 05:03 PM
Find date query and Display issue VBA Noob Excel Worksheet Functions 2 July 14th 06 11:23 PM
ms query xp issue quaoar Excel Programming 0 November 23rd 03 08:23 PM


All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"