Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:43:39+00:00 2026-06-17T16:43:39+00:00

I want to count rows created/inside (dont know what it is called) a trigger.

  • 0

I want to count rows created/inside (dont know what it is called) a trigger.

like i have a trigger :

CREATE
DEFINER=`root`@`localhost`
TRIGGER `mydb`.`tn_air_staff_leave_application`
AFTER INSERT ON `mydb`.`staff_leave_application`
FOR EACH ROW
BEGIN
----
----
----
END$$

and want to know how many rows trigger is going to create, I need this value inside trigger:

set @newrows:= (select count(*) from tn_air_staff_leave_application); 

is it possible?? if not any other solution out there???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:43:40+00:00Added an answer on June 17, 2026 at 4:43 pm

    A trigger is a purely passive piece of code which is executed before or after a row is inserted, updated or deleted from a table in your database.

    The trigger can not be executed actively anc thus does not have a return value you can read.

    What you can do is to let your trigger write a value into another table or into a session variable which then can be queried for in an extra query.

    You can not store a whole result row or a result set of several rows into a session variable like you are trying in your example.

    In MySQL the trigger is always executed FOR EACH ROW, means within the trigger you will only look at one row, not at several.

    EDIT:

    Actually your example query returns a single value, so this would work. (would deliver the amount of total records in your tn_air_staff_leave_application table into the local session variable @newrows)

    For more specific help you would need to be more specific on what you’re trying to do

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hay, I'm using django 1.2 and i want to know how to count rows
I have a MySql table where I want to get the count of rows
I have a query which returns two rows of data as count. I want
I want to count rows returned by subselect with Doctrine. The subselect I have
I have a dynamically created HTML string (a table rows). That rows count in
I want to subtract between two rows of different table: I have created a
I want to count the rows in several date ranges (i.e: last hour, today,
I want to perform action on change in count of rows of an HTML
What I want to do is count the number of rows returned by a
I want to count how many times i built on VS.NET . I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.