Computed columns and functions?

Поиск
Список
Период
Сортировка
От David Benoff
Тема Computed columns and functions?
Дата
Msg-id 000b01c38698$ebd71c00$ba00a8c0@david
обсуждение исходный текст
Ответы Re: Computed columns and functions?  (Bruno Wolff III <bruno@wolff.to>)
Re: Computed columns and functions?  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-novice

Hi all,

I’d like to set up a computed column that uses a function to derive its data, but can’t seem to find any information on how to do this.  My issue, specifically, is this:

 

I have a user table and an account activity table, which contains records of debits and credits to an account, user id as FK.  I’d like to create a computed column within my user table to show the user’s current balance (sum of credits minus sum of debits).  I’ve written a sql query to compute this when passed in a user id as an argument, but I can’t figure out how to create the computed column.

 

Any tips would be much appreciated.

 

Thanks,

David Benoff


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003

В списке pgsql-novice по дате отправления:

Предыдущее
От: Oliver Fromme
Дата:
Сообщение: Re: Foreign keys and null
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Foreign keys and null