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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:19:40+00:00 2026-05-30T11:19:40+00:00

Here is an example table for my problem: 100 IDO 0514443421 100 IDO 0504899721

  • 0

Here is an example table for my problem:

100     IDO     0514443421
100     IDO     0504899721
100     IDO     0508843421
101     LIRAN   0523399721
101     LIRAN   0524899721
102     ERAN    0593369721
102     ERAN    0599999721

I want to get back a row like that:

100, IDO, 0514443421, 0504899721, 0508843421

I’m aware of the problematic fact of the changing rows number. I can settle for fixed 3 output columns, some of them can be empty.

Any good method for achieving this?

Thank u in advance.

  • 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-30T11:19:41+00:00Added an answer on May 30, 2026 at 11:19 am

    Try:

    ;with cte as 
    (select id,
            colA,
            colB,
            rownumber() over (partition by id, colA order by colB) rn
     from myTable)
    select id, colA, t1.colB colB1, t2.colB colB2, t3.colB colB3
    from cte t1
    left join cte t2 on t1.id = t2.id and t1.colA = t2.colA and t2.rn = 2
    left join cte t3 on t1.id = t3.id and t1.colA = t3.colA and t3.rn = 3
    where t1.rn = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an example on JSFiddle . Excerpt of code: <table style=height:100%> <tr height=20><td></td></tr> <tr>
Here is an example of what I've got going on: CREATE TABLE Parent (id
Just using this as an example... Here are the columns in my UserProfile table:
This problem is not readily reproducible in a simple example here but was wondering
Here's my problem: I have an HTML table that looks like this: What I
I got an oracle db 10g, here a table as an example create table
Here's a basic illustration of the problem: <html><head><style type=text/css> html {width: 100%; height: 100%;
I have normal table, nothing special about it, here it is: live example :
The fictional example here. Suppose I designed a class named IODevice. This class already
I found a great C++/ODBC example here ... The project I downloaded builds great

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.