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 454687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:17:44+00:00 2026-05-12T22:17:44+00:00

I have the following MySQL table: +———+————+——+——–+——+———+————+——-+———+———-+————+————+ | Version | Yr_Varient | FY |

  • 0

I have the following MySQL table:

+---------+------------+------+--------+------+---------+------------+-------+---------+----------+------------+------------+
| Version | Yr_Varient | FY   | Period | CoA  | Company | Item       | Mvt   | Ptnr_Co | Investee | GC         | LC         |
+---------+------------+------+--------+------+---------+------------+-------+---------+----------+------------+------------+
| 201     | 1          | 2010 | 1      | 11   | 23      | 1110105000 | 60200 |         |          | 450000     | 450000     |
| 201     | 1          | 2010 | 1      | 11   | 23      | 2110300000 | 60200 |         |          | -520000    | -520000    |
| 201     | 1          | 2010 | 1      | 11   | 23      | 1220221600 |       |         |          | 78080      | 78080      |
| 201     | 1          | 2010 | 1      | 11   | 23      | 2130323000 |       |         |          | 50000      | 50000      |
| 201     | 1          | 2010 | 1      | 11   | 23      | 2130322000 |       |         |          | -58080     | -58080     |
| 201     | 1          | 2010 | 1      | 11   | 23      | 3100505000 |       |         |          | -275000    | -275000    |
| 201     | 1          | 2010 | 1      | 11   | 23      | 3200652500 |       |         |          | 216920     | 216920     |
| 201     | 1          | 2010 | 1      | 11   | 23      | 3900000000 |       |         |          | 58080      | 58080      |
| 201     | 1          | 2010 | 1      | 11   | 26      | 1110105000 | 60200 |         |          | 376000     | 376000     |
| 201     | 1          | 2010 | 1      | 11   | 26      | 2110300000 | 60200 |         |          | -545000    | -545000    |
| 201     | 1          | 2010 | 1      | 11   | 26      | 1220221600 |       |         |          | 452250     | 452250     |
| 201     | 1          | 2010 | 1      | 11   | 26      | 2130323000 |       |         |          | -165000    | -165000    |
| 201     | 1          | 2010 | 1      | 11   | 26      | 2130322000 |       |         |          | -118250    | -118250    |
| 201     | 1          | 2010 | 1      | 11   | 26      | 3100505000 |       |         |          | -937750    | -937750    |
| 201     | 1          | 2010 | 1      | 11   | 26      | 3200652500 |       |         |          | 819500     | 819500     |
| 201     | 1          | 2010 | 1      | 11   | 26      | 3900000000 |       |         |          | 118250     | 118250     |
| 201     | 1          | 2010 | 1      | 11   | 37      | 1110105000 | 60200 |         |          | 777000     | 777000     |
| 201     | 1          | 2010 | 1      | 11   | 37      | 2110308000 | 60200 | 43      |          | -255000    | -255000    |
| 201     | 1          | 2010 | 1      | 11   | 37      | 2130321500 |       |         |          | 180000     | 180000     |
| 201     | 1          | 2010 | 1      | 11   | 37      | 2130322000 |       |         |          | -77000     | -77000     |
| 201     | 1          | 2010 | 1      | 11   | 37      | 2310407001 |       | 1       |          | -625000    | -625000    |
| 201     | 1          | 2010 | 1      | 11   | 37      | 3100505000 |       |         |          | -2502500   | -2502500   |
| 201     | 1          | 2010 | 1      | 11   | 37      | 3200652500 |       |         |          | 2425500    | 2425500    |
| 201     | 1          | 2010 | 1      | 11   | 37      | 3900000000 |       |         |          | 77000      | 77000      |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1110105000 | 60200 |         |          | 2600000    | 2600000    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1140161000 | 60200 |         | 23       | 430000     | 430000     |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1140161000 | 60200 |         | 26       | 505556     | 505556     |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1140160000 | 60200 | 37      |          | 255000     | 255000     |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1160163000 | 60200 | 99999   | 48       | 49428895   | 49428895   |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1160163000 | 60200 | 99999   | 49       | 188260175  | 188260175  |
| 201     | 1          | 2010 | 1      | 11   | 43      | 2310405500 |       |         |          | -237689070 | -237689070 |
| 201     | 1          | 2010 | 1      | 11   | 43      | 2110300000 | 60200 |         |          | -1000      | -1000      |
| 201     | 1          | 2010 | 1      | 11   | 43      | 2110300500 | 60200 |         |          | -3999000   | -3999000   |
| 201     | 1          | 2010 | 1      | 11   | 43      | 1220221600 |       |         |          | 1571112    | 1571112    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 2130321500 |       |         |          | -805556    | -805556    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 2130322000 |       |         |          | -556112    | -556112    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 3100505000 |       |         |          | -836000    | -836000    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 3200652500 |       |         |          | 781000     | 781000     |
| 201     | 1          | 2010 | 1      | 11   | 43      | 3300715700 |       | 99999   | 32       | -440000    | -440000    |
| 201     | 1          | 2010 | 1      | 11   | 43      | 3300715700 |       | 99999   | 26       | -61112     | -61112     |
| 201     | 1          | 2010 | 1      | 11   | 43      | 3900000000 |       |         |          | 556112     | 556112     |
+---------+------------+------+--------+------+---------+------------+-------+---------+----------+------------+------------+

I need to take all rows with Mvt = 60200 and multiply every GC and LC record in that row by 1.1 and add a new row containing the changes back into the same table with FY set to 2011.

How can I do all this in 1 statement?
Is it even possible to do all this in 1 statement (I know very little about SQL)?
Can this be done in standard SQL as the database will be ported to another Database Server?
I don’t know which server it will be.

  • 1 1 Answer
  • 1 View
  • 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-05-12T22:17:45+00:00Added an answer on May 12, 2026 at 10:17 pm

    In standard SQL (there may be better ways in vendor-specific implementations but I tend to prefer standard stuff where possible):

    insert into mytable (
        Version, Yr_Varient, Period, CoA, Company, Item, Mvt, Ptnr_Co, Investee,
        FY, GC, LC
    ) select
        Version, Yr_Varient, Period, CoA, Company, Item, Mvt, Ptnr_Co, Investee,
        2011, GC*1.1, LC*1.1
        from mytable
        where Mvt = 60200
        -- and FY = 2010
    

    You may also want to limit your select statement a little more depending on the results of your testing, such as uncommenting the and FY = 2010 line above to stop copying all your 2009 and 2008 data as well, if any. I asume you only wanted to carry forward the previous year’s stuff with a 10% increase on GC and LC.

    The way this works is to run the select which gives modified data for FY, GC and LC as per your request, and pump all those rows back into the insert.

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

Sidebar

Ask A Question

Stats

  • Questions 229k
  • Answers 229k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Can't you install from Synaptic Package Manager May 13, 2026 at 1:49 am
  • Editorial Team
    Editorial Team added an answer Since you are asking: Yes, it is possible. Create an… May 13, 2026 at 1:49 am
  • Editorial Team
    Editorial Team added an answer Consider changing the keyword UPGRADE in your SQL to UPDATE,… May 13, 2026 at 1:49 am

Related Questions

I have the following table: mysql> SELECT * FROM `bright_promotion_earnings`; +----+----------+------------+----------+-------+ | id |
I have the following query: mysql> explain SELECT Exhibition.venue_id, Exhibition.name, Exhibition.slug, Venue.name, Venue.slug, Venue.location_id,
I have the following table: id | kwh | cost --------------------- 1 | 10
I've been experimenting with fulltext search lately and am curious about the meaning of
Here's a sample table to help illustrate my problem: mysql> select * from test;

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.