On 09/01/2011 01:39 AM, Marcos Hercules Santos wrote:
One way to do this would be with a view, so you don't need the trigger. The other one would need to be after update, insert and delete. This would include code such as:hi guys I'm newbie in Psql and I'm trying to build one function in order to count the products for each supplier. So i'm gonna put it quite simply though this example Please, consider a table called books with the following fields bookid, title, price, idPublisher and one another table called publisher Idpublisher, name, city, Books Being in that last field from Publisher, called book, I gotta have the amount of published books for each publisher. update publisher set books=books[+|-]1 where idpublisher=[new|old].idpublisher; Sim |