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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:18:10+00:00 2026-05-24T09:18:10+00:00

I have a table containing several fields. The primary key is userId . Currently

  • 0

I have a table containing several fields. The primary key is userId. Currently the user id column contains values ‘1,2,3,4…etc’ like so:

+------+
|userId|
+------+
|  1   |
|  2   |
|  3   |
|  4   | 
...etc

I now want to add new rows ending in a,b,c, like so:

+------+
|userId|
+------+
|  1   |
|  1a  |
|  1b  |
|  1c  | 
|  2   |
|  2a  |
|  2b  |
|  2c  | 
...etc

The new rows should be identical to their parent row, except for the userId. (i.e. 1a,1b & 1c should match 1)

Also I can’t guarantee that there won’t already be a few ‘a’, ‘b’ or ‘c’s in userid column.

Is there a way to write an sql query to do this quickly and easily?

  • 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-24T09:18:11+00:00Added an answer on May 24, 2026 at 9:18 am

    DON’T DO IT you will run into more problems than the one you are trying to solve!

    add a new column to store the letter and make the primary key cover the original UserId and this new column.

    If you ever just want the userId, you need to split the letter portion off, which will be expensive for your query and be a real pain.

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

Sidebar

Related Questions

I have a sql-file containing several statements like this: create table user ( name
Let's say we have a [Valuations] table containing several values per date and per
I have PostgreSQL table with several boolean columns, currently containing only true or null
I have a table with several hundred records, each one containing a datetime column.
I have a table that contains several rows each containing one button and one
I have a table containing reports and the date/time they were created. I'd like
I have a table containing 2 date fields and an identifier (id, fromdate and
I have several tables, containing (a.o.) the following fields: tweets: -------------------------- tweet_id ticker created_at
In a MySQL table, I have several columns - some containing strings, some dates
Lets say I have a table containing several hundred million rows that looks something

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.