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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:48:03+00:00 2026-06-13T03:48:03+00:00

So I have this data structure ID DATE1 STATUS1 DATE2 STATUS2 1 1/1/2012 1

  • 0

So I have this data structure

ID  DATE1     STATUS1 DATE2    STATUS2
1   1/1/2012  1       1/1/2012 3
1   3/1/2012  1       1/2/2012 3 
2   2/1/2012  1       3/4/2012 3
3   4/1/2012  1       NULL     3
4   2/1/2012  1       6/2/2012 3

How would I get to…

ID  DATE      STATUS
1   1/1/2012  1
1   1/1/2012  3
1   3/1/2012  1       
1   1/2/2012  3
2   2/1/2012  1       
2   3/4/2012  3
3   4/1/2012  1       
3   NULL      3
4   2/1/2012  1       
4   6/2/2012  3

My initial guess might be to use lots of unioned unpivots?

  • 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-13T03:48:05+00:00Added an answer on June 13, 2026 at 3:48 am

    You can use union for this:

    select id, date1 mydate, status1 status
    from mytable
    union all
    select id, date2 mydate, status2 status
    from mytable
    

    if you want to remove dupes, just replace union all with union

    Note: I’ve named the resulting date column mydate because date is probably a reserved keyword in whichever dbms you’re using..

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

Sidebar

Related Questions

i have a time series data like this: x <- structure(list(date = structure(c(1264572000, 1266202800,
I have an array of data get from the server(ordered by date): [ {date:2012-8,
My table have data structure like this cate_id task_id date_start date_end other 34 14
I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1
i have data structure i am passing this from server to client using data
I have this HTML structure <div class=buttons> <button data-icon=ui-icon-disk class=save>Save1</button> <button data-icon=ui-icon-check class=ok>OK1</button> <button
Using EF4 and Linq I have a data structure which looks like this: parentid
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
I have some data and need to create a json file with this structure
I have table the following data structure in SQL Server: ID Date Allocation 1,

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.