View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Seamus Conlon Seamus Conlon is offline
external usenet poster
 
Posts: 12
Default Passing parameter to a select query

I have a worksheet that I need to update on a daily basis
with data from an external Oracle database. I am using
the following query which gets yesterday's data (the Oracle
data is always for the previous day).

SELECT Sum(recno) FROM mailboxes
WHERE (trunc(logdate)=trunc(sysdate-1))

This sums the values in the rec_no column for all rows
that were logged yesterday. The thing is that on a Monday,
I need to get the data for both Saturday and Sunday so
would need to be able to pass the date as a parameter
rather than having to manually change the query.

How does one do this?

Many thanks,
Seamus