SP to calc shipments vs receipts

Поиск
Список
Период
Сортировка
От Bret Stern
Тема SP to calc shipments vs receipts
Дата
Msg-id 1379999589.7123.9.camel@centos-dev.machinemanagement.com
обсуждение исходный текст
Ответы Re: SP to calc shipments vs receipts  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
I have an inventory transaction table with several fields,
specifically:
part_no
trans_type
trans_qty

part_no | trans_type | trans_qty
abc        REC    5000    (receipt)
abc        REC    400    (receipt)
abc        SHP    1000    (shipment)
abc        ALL    1000    (allocated)

Looking for the best way to show following totals with SQL

on_hand    |    allocated    | available
3400        1000                 4400

Thinking of writing a stored procedure that has the aggregate queries,
and returns the values defined above for this example.

Is this a recommended way?

B Stern







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

Предыдущее
От: Karl Denninger
Дата:
Сообщение: Re: streaming replication not working
Следующее
От: John R Pierce
Дата:
Сообщение: Re: SP to calc shipments vs receipts