I fail to understand what you are attempting to do.
What does your table represent and what output you expect to have..?
To my best knowledge this (select meter1 where sampledate = sampledate + interval '1 days') is not valid SQL so could you please explain in english the info
you want to obtain from your table?
----- Original Message -----
From: Mark King
Sent: Monday, April 18, 2011 4:16 PM
Subject: [NOVICE] can a function take a column name or is there another solution
I have a table with sampledate, meter1, meter2...etc
I am trying to develop a function or query
select sampledate, (meter1 - (select meter1 where sampledate = sampledate + interval '1 days')) as consumption from mytable;
Any ideas how to make this work?