can a function take a column name or is there another solution

From: Mark King <fires10(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: can a function take a column name or is there another solution
Date: 2011-04-18 15:16:28
Message-ID: BANLkTimc=jekwHNkhE4-eVZwEzHbyx5hTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a table with sampledate, meter1, meter2...etc

I am trying to develop a function or query

where:

select sampledate, (meter1 - (select meter1 where sampledate = sampledate +
interval '1 days')) as consumption from mytable;

Any ideas how to make this work?

Mark King

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliveiros d'Azevedo Cristina 2011-04-18 15:35:19 Re: can a function take a column name or is there another solution
Previous Message Maximilian Tyrtania 2011-04-18 12:48:07 Re: Can a client connection set variables on the server-side?