We help IT Professionals succeed at work.
Get Started

Complex Query

79 Views
Last Modified: 2015-03-12
Hello,

I need to construct a SQL 2008 table and associated query that can produce the following output
The table will contain a list of tasks; one of the fields will be a completion date.  When the query is run the query needs to be smart enough to work out the next 12 months from now and then populate the tasks to which month the completion date falls.  This in itself is quite complex, however to add a further layer of complexity it can’t be 1 row one date, all white spaces must be used.

Here is what the source table might look like

task_id      task      completion_date
1      Task 1      Mar
2      Task 2      May
3      Task 4      Mar
4      Task 5      Apr

For example instead of producing this:

Mar      Apr      May
Task 1              
       Task 5       
Task 4              
              Task 2

I need it to produce something like this:

Mar      Apr      May
Task 1      Task 5      Task 2
Task 4              
               
               

I have a completely free reign as to how the table can be structured in order to best achieve this outcome.
TIA
Comment
Watch Question
Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 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