Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Query
Hello,
I have an existing SQL query that I run every day and then export the results into an excel spreadsheet. The SQL script that I run returns the previous days information from the DB using a SYSDATE -1 statement. I know that I can create an ODBC connection and build and run this query within Excel itself. My problem is that we work on Saturdays and if I run the query on Monday it will bring back zero results because the SYSDATE -1 will bring back the results from Sunday. As it stands now, I manually edit the SQL script to bring back the information from Saturday. How could I write this query within Excel so that on Mondays only, the query code will know to go back 2 days to get Saturday's info which would be SYSDATE -2 and then the rest of the week the query would just run SYSDATE -1? If I could accomplish this task, I could give this Excel spreadsheet to the Mgr. of the deptartment along with an ODBC Connection and then they could run this report on their own which would be one less thing on my plate. Any assistance with this issue will be greatly appreciated. Thank you in advance. Dave Y |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Query
"Dave Y" wrote ...
script that I run returns the previous days information from the DB using a SYSDATE -1 statement. As it stands now, I manually edit the SQL script to bring back the information from Saturday. I don't have Oracle to check how its proprietary functions work but could you perhaps test for Monday using: to_char(sysdate,'DDD') in a CASE (or equivalent) statement? Jamie. -- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Query
Hi Jamie,
Thank you for reply. I will try giving a CASE Statement a try. Dave Y -----Original Message----- "Dave Y" wrote ... script that I run returns the previous days information from the DB using a SYSDATE -1 statement. As it stands now, I manually edit the SQL script to bring back the information from Saturday. I don't have Oracle to check how its proprietary functions work but could you perhaps test for Monday using: to_char(sysdate,'DDD') in a CASE (or equivalent) statement? Jamie. -- . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 / MS Query - editing existing query to another sheet | Excel Discussion (Misc queries) | |||
Query from microsoft query- Excel 2007 | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) |