troubleshooting Question

SQL Select - Populate empty column rows

Avatar of tmajor99
tmajor99 asked on
Microsoft SQL Server 2008
3 Comments1 Solution90 ViewsLast Modified:
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,
ASKER CERTIFIED SOLUTION
Shaun Kline
Lead Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros