1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trigger to display the count

Discussion in 'MySQL' started by Dilini, Sep 18, 2015.

  1. Dilini

    Dilini New Member

    Joined:
    Sep 18, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    This is my first Trigger I want to count the no of records related to 2007
    Code:
    DELIMITER $$
    CREATE TRIGGER No_of_Publisher_year 
    After Insert ON Books 
    FOR EACH ROW 
    Begin
    Set @Count_NO = @Count_NO + New.Copyright;
        SELECT Count(*) AS 'No_of_publisher_in_year_2007' 
        FROM Books WHERE Copyright=2007;
    END $$
    DELIMITER ;
    
    ERROR 1415 (0A000): Not allowed to return a result set from a trigger:embarasse
     

Share This Page