We help IT Professionals succeed at work.
Get Started

SQL Select - Populate empty column rows

tmajor99
tmajor99 asked
on
87 Views
Last Modified: 2016-04-12
Is it possible to have SQL Select populate columns from other columns conditionally?  For example; I have 1 table with four columns as follows;

Current Week Folder Name   Current-Product-Count              Prior Week Folder Name   Prior-Product-Count
Abrasives                                            98                                                         Abrasives                 100
                                                                                                                           Filters                            9
Conditioner                                    2100                                      
Plugs                                                    31                                                         Plugs                           31

What I want is to populate the empty column rows with either the current or prior week column so the file looks like this:

Current Week Folder Name   Current-Product-Count              Prior Week Folder Name   Prior-Product-Count
Abrasives                                            98                                                         Abrasives                 100
Filters                                                    0                                                         Filters                            9
Conditioner                                    2100                                                        Conditioner                  0
Plugs                                                    31                                                         Plugs                           31

As you can see I want to fill in the blank columns with the value the prior or current week,
Comment
Watch Question
Lead Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE