Here is my function:
CREATE OR REPLACE FUNCTION public.getLatestInBinsBetween(timestamp,
timestamp, varchar, varchar)
RETURNS SETOF record AS
'
SELECT cmt.binid, cmt.sitename, cmt.exerciseid,
Max(cmt.datetimestamp) AS datetimestamp, max(cmt.issuancetime) AS
IssuanceTime
FROM consolidatedMetReading cmt INNER JOIN (SELECT Distinct BinID,
SiteName, ExerciseID
FROM consolidatedMetReading gbib
WHERE gbib.BinID BETWEEN $1 and $2
AND gbib.SiteName = $3
AND gbib.ExerciseID = $4) gbib
ON gbib.BinID = cmt.BinID
AND gbib.SiteName = cmt.SiteName
AND gbib.ExerciseID = cmt.ExerciseID
GROUP BY cmt.binid, cmt.sitename, cmt.exerciseid
ORDER BY cmt.binid, cmt.sitename, cmt.exerciseid
'
LANGUAGE 'sql' VOLATILE;
here is the sql statement from a SQL window:
SELECT *
FROM getLatestInBinsBetween('10-08-2003', '10-09-2003', 'Anniston',
'real')
AS gLIBB(binid timestamp, sitename varchar, exerciseid varchar,
datetimestamp timestamp, issuancetime timestamp)
How can I execute this from a ADO connection?
Thomas LeBlanc
_________________________________________________________________
Fast, faster, fastest: Upgrade to Cable or DSL today!
https://broadband.msn.com