Please help me write this query or function

Поиск
Список
Период
Сортировка
От Mr OCP
Тема Please help me write this query or function
Дата
Msg-id 20011211125445.96186.qmail@web20609.mail.yahoo.com
обсуждение исходный текст
Ответы Re: Please help me write this query or function
Список pgsql-admin
Hi

We have a table like follows:

id, account_name, amount, action_type

The amount field has both debit and credit entires and
action_type defines the type of transaction ( debit or
credit), debit entries have negative '-' symbol before
the amount.

where there are multipble transaction for the same id,
I need to write a query as under:

select id, amount(credit), amount(debit), amount
credit - amount debit from table where id is the same;

Its making it difficult for me because the amount
field has both debit and credit entries, your ideas,
codes or sql will be much appreciated.

Thanks
Mike

http://shopping.yahoo.com.au - Yahoo! Shopping
- Free CDs for thousands of Priority Shoppers!

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

Предыдущее
От: Chao Lu
Дата:
Сообщение: the results of pgbench are not stable (in tps)
Следующее
От: bpalmer
Дата:
Сообщение: Re: problems doing sub-selects on PostgreSQL 7.1.3 and