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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:33:07+00:00 2026-05-24T16:33:07+00:00

Lets say i have a table like this: col1 col2 col3 row1 1 null

  • 0

Lets say i have a table like this:

    col1     col2     col3
row1  1       null    null

row2  null    2       null

row3  null    null    3

All data types are numbers, integers or long. And i need a table like this:

    col1     col2     col3
row1  1       2        3

How can i accomplish this with an sql statement? I assume i have to create a new table and insert a new row with a select statement, but i am more of a coder and not sure what kind of statement i should use. Thanks for the help.

  • 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-24T16:33:08+00:00Added an answer on May 24, 2026 at 4:33 pm

    sllev got me on the right track. In my case, because all values except for one were always going to be null in any given column, i just had to use the MAX() function. my final sql statement looked like this:

    Select MAX(Merge_Table_Parcel_1.txtFrequency1) AS Frequency1,
           MAX(Merge_Table_Parcel_1.SUM_INST_N) AS SUM_INST_N1,
           MAX(Merge_Table_Parcel_1.SUM_INST_D) AS SUM_INST_D1,
           MAX(Merge_Table_Parcel_1.SUM_CTRN_D) AS SUM_CTRN_D1,
           MAX(Merge_Table_Parcel_1.SUM_CTRN_N) AS SUM_CTRN_N1,
           MAX(Merge_Table_Parcel_1.SUM_TRAN_N) AS SUM_TRAN_N1,
           MAX(Merge_Table_Parcel_1.SUM_PPU) AS SUM_PPU1,
           MAX(Merge_Table_Parcel_1.SUM_PPUJOBS) AS SUM_PPUJOBS1,
           MAX(Merge_Table_Parcel_1.SUM_DAYT) AS SUM_DAYT1,
           MAX(Merge_Table_Parcel_1.SUM_RESD_D) AS SUM_RESD_D1,
           MAX(Merge_Table_Parcel_1.SUM_RESD_N) AS SUM_RESD_N1,
           MAX(Merge_Table_Parcel_1.SUM_ON_STRN_D) AS SUM_ON_STRN_D1,
           MAX(Merge_Table_Parcel_1.SUM_ON_STRN_N) AS SUM_ON_STRN_N1
      FROM Merge_Table_Parcel_1
    

    Simple, i know, but i dident see it right away. Thank you to everyone who contributed a response, and to sllev who pointed me in the right direction.

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

Sidebar

Related Questions

I have two tables. Lets say they look like this Table Sports: Column 1:
So lets say I have a table that looks something like this: ItemName ProductType
Lets say I have table like this: String | Int1 | Int2 "foo" 5
Lets say I have a table like this. A | B ----- 1 |
Let's say I have a table like this: name | score_a | score_b -----+---------+--------
In MS Transact SQL, let's say I have a table (Orders) like this: Order
Let's say I have a MySQL table that is something like this: software table:
lets say i have this table user|group|acceptance 1 | a | -1 2 |
Lets say I have a view file that is built like this: <html> ...
Lets say I have this SQL Table id | name | date 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.