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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:20:22+00:00 2026-06-17T09:20:22+00:00

I have an table column filled with usersIDs from a survey, but somehow the

  • 0

I have an table column filled with usersIDs from a survey, but somehow the userID was written twice in each record. like below

UserID
========
35863586
12341234
321321

I’ve seen Aaron Alton’s suggestion about removing certain characters, but in my case, I’ll have to remove half of whatever the ID is to get it right because sometime the id is 8 digit sometimes 6 digits.

So this wouldn’t help much,

SELECT RIGHT(MyColumn, LEN(MyColumn) - 4) AS MyTrimmedColumn

Can someone suggested a way to solve my problem please?

Thanks very much

  • 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-17T09:20:23+00:00Added an answer on June 17, 2026 at 9:20 am

    since you have mentioned that the length is 6 and sometimes 8,

    divide the length by two

    SELECT RIGHT(MyColumn, LEN(MyColumn) - (LEN(MyColumn) / 2)) AS MyTrimmedColumn
    
    • SQLFiddle Demo

    or simply

    SELECT UserID, RIGHT(UserID, (LEN(UserID) / 2)) AS MyTrimmedColumn
    FROM   table1
    
    • SQLFiddle Demo
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table which is filled from external application. I need to fill column
I have a column in table recipes called Products. This is is filled like
I have a table column where each row has one of three states, and
I have table column filled with float values e.g.: id-Values 1- 0.19230769230769232 2- 8.4848484848484854E
I have a table with many rows of data, which has an column filled
I have a mysql database table that gets the datetime column automatically filled when
So I have a table of office locations and each column contains the relevant
I have a table filled with bus stops. Each stop has a line_id ,
I have a table with two columns: Country OrderView Country column is already filled.
In my application, I have a QSqlTableModel filled with a table coming from a

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.