#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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
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
Excel 2007 / MS Query - editing existing query to another sheet Hotpepperz Excel Discussion (Misc queries) 0 June 13th 08 06:53 PM
Query from microsoft query- Excel 2007 טבלאות אקסל 2007 Excel Discussion (Misc queries) 0 December 24th 07 10:47 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 1 November 29th 05 01:44 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 0 November 28th 05 06:37 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 11:38 PM.

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

About Us

"It's about Microsoft Excel"