| От | Josh Berkus |
|---|---|
| Тема | Re: conversi ms-sql7 vs postgresql 7.3 |
| Дата | |
| Msg-id | 200302101340.54373.josh@agliodbs.com обсуждение |
| Ответ на | Re: conversi ms-sql7 vs postgresql 7.3 (greg@turnstep.com) |
| Список | pgsql-sql |
Greg, > > command in ms-sql 7 can use calculate field (column) balance from id=1 > > to id=4: "update xx set bal=balance=bal+debet-credit" > > You cannot do such a thing in SQL alone: you must use a procedural > language. One way is with plpgsql: You're mistaken, I think (I can't find the original e-mail in this thread) UPDATE totals SET balance = total_bal FROM (SELECT acct_id, (sum(credit) - sum(debit)) as total_balFROM accounts GROUP BY acct_id) tb WHERE tb.acct_id = totals.acct_idAND totals.acct_id = $selection ... would update a ficticious "totals" table with the sum of credits and debits for a particular account. -- -Josh BerkusAglio Database SolutionsSan Francisco
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера