MySQL Forums
Forum List  »  Triggers

Getting Multiple records from one table
Posted by: jacek.wagner
Date: July 07, 2006 02:28PM

ELIMITER $$;
DROP TRIGGER `psm`.`UpdateProductMainProductStatesInventory`$$
create trigger `UpdateProductMainProductStatesInventory` AFTER UPDATE on `ProductSeller`
for each row BEGIN
DECLARE ProductUID int;
DECLARE N_stateCount INT default 20;
DECLARE ListPricesum int default 155;

SELECT COUNT(*),sum(ListPrice) INTO N_stateCount, ListPricesum FROM ProductSeller WHERE ProductUID = new.ProductUID;
SELECT COUNT(*),sum(ListPrice) INTO N_stateCount, ListPricesum FROM ProductSeller;

From those two select statements the first one always returns 0 count and 0 sum
The second, without the WHERE statement returns counts for all records in ProductSeller table.
How to make working the one with the WHERE statement
Note: there are no errors when the trigger is running

Jacek



Edited 3 time(s). Last edit at 07/07/2006 02:48PM by jacek.wagner.

Options: ReplyQuote


Subject
Views
Written By
Posted
Getting Multiple records from one table
2520
July 07, 2006 02:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.