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

  • Home
  • SEARCH
  • 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 8920899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:23:46+00:00 2026-06-15T06:23:46+00:00

I wrote following code: create trigger money after update on `things` for each row

  • 0

I wrote following code:

create trigger money after update on `things`
for each row
begin
   Select @c1=sum(`thing_cost`) from `things`
   UNION
   Select @c2=sum(`salary`) from `dude_base`
   Update `current` set `curr_cash`=@c1*@c2/100
end;
$$

Table “things” has got:

id1 (PK)
name
thing_cost

Table dude_base has got:

id2 (PK)
salary
name, etc. irrevelant

Table current has got:

id1 (FK)
id2(FK)
curr_cash

I got following error:

 #1064 - You have an error in your SQL syntax; check the manual that corresponds to   
 your MySQL server version for the right syntax to use
 near 'Update `current` set `curr_cash`=@c1*@c2/100; END' at line 7

Any help?

  • 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-15T06:23:47+00:00Added an answer on June 15, 2026 at 6:23 am

    I think you should have a semicolon ; like

    Select @c2=sum(`salary`) from `dude_base`;
    

    to end this query because UPDATE is another query

    // edit

    try it like this

    SET @c1 = (SELECT sum(`thing_cost`) from `things`);
    SET @c2 = (SELECT sum(`salary`) from `dude_base`);
    UPDATE `current` SET `curr_cash` = @c1 * @c2 / 100
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Someone has helped me write the following: CREATE TRIGGER update_stats AFTER UPDATE ON user_hours
i wrote following code to create a linkbutton programmatically, but its showing like lable
I wrote the following code to select text from database,but when i echo the
I wrote the following code for a Link list to create a Book its
I wrote the following code. It tries to create a storyboard that does the
I wrote the following code in SQLite : CREATE TABLE payments ( customerNumber REAL
I wrote the following code: It should accept a file name and create it
I wrote the following code to create a dojo tree. store = new dojo.data.ItemFileWriteStore({url:
I wrote following code...but i am getting Error like: Error 1 'LoginDLL.Class1.Login(string, string, string)':
I wrote the following code for text file encryption and decryption. The encryption process

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.