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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:39:57+00:00 2026-05-11T22:39:57+00:00

We have a table that is used for assessment-values in our tool where each

  • 0

We have a table that is used for assessment-values in our tool where each value has its valueid. Dont ask me who came up with this so called design, but now I need to add multiple valueids to the end for each assessment.

So, it looks like this:

AssessmentId 1, ValueId 1, Value
AssessmentId 1, ValueId 2, Value
AssessmentId 1, ValueId 3, Value
AssessmentId 2, ValueId 1, Value
AssessmentId 2, ValueId 2, Value
AssessmentId 2, ValueId 3, Value

I now probably need a subquery that returns all distinct assessmentids and for each of those I add my rows

AssessmentId 1, ValueId 7, empty
AssessmentId 1, ValueId 8, empty
AssessmentId 1, ValueId 9, empty
AssessmentId 2, ValueId 7, empty
AssessmentId 2, ValueId 8, empty
AssessmentId 2, ValueId 9, empty
...

Honestly, I have no clue how to achieve this. Maybe a subselect with a group, but how would I then get the selected assessmentid into the new insert?

Edit:
well, actually we have 709 values for each assessment and now we need 24 more at the end for additional data

foreach distinct assessmentid in table
{ 
   insert row (assessmentid, 710, null); 
   insert row (assessmentid, 711, null); 
   ... 
   insert row (assessmentid, 733, null); 
}

something like this

  • 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-05-11T22:39:57+00:00Added an answer on May 11, 2026 at 10:39 pm
    INSERT
    INTO    i_should_really_name_the_tables_i_ask_about_on_stackoverflow_com (assessmentid, valueid)
    SELECT  assessmentId, valueMax + lvl
    FROM    (
            SELECT  assessmentId, MAX(valueId) AS valueMax
            FROM    i_should_really_name_the_tables_i_ask_about_on_stackoverflow_com t
            GROUP BY
                    assessmentId
            ) a
    CROSS JOIN
            (
            SELECT  level AS lvl
            FROM    dual
            CONNECT BY
                    level <= 24
            ) l
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my applications I have a 1gb database table that is used
I have a table that has redundant data and I'm trying to identify all
I have a table that has an insert trigger on it. If I insert
I have a table that is used to store an incrementing numeric ID (of
I have a table that's used to store some temporary bookkeeping stuff. It needs
In HTML I have a table that is used as a grid. Now, I
I have a table that contains in each row an input and a save
I have a table that is dynamically built using DOM. It has 10 cols,
I have a table that has worked correctly for many years, but recently the
We have a table and a set of procedures that are used for generating

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.