Solved

*** SQL Combine 2 Queries and Display Rows as Columns

Posted on 2013-06-04
2
312 Views
Last Modified: 2013-06-04
Hello Experts,

I have 2 queries.

1st Query produces:

ID    Status           Qty_BLUE
10    Pending         12
11    Processed      25
12    Completed     14

2nd Query Produces:

ID    Status           Qty_RED
20    Pending          45
21    Processed       31
22    Completed     17

I would like to combine the results from both queries to look like this:

Status           Qty_BLUE    Qty_RED
Pending         12                  45
Processed      25                  31
Completed     14                 17

Your help is GREATLY appreciated!  Thank you!!
0
Comment
Question by:giggul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 500 total points
ID: 39219712
just join the 2 queries on status

SELECT Red.Status, Red.QtyRed, Blue.QtyBlue
FROM
   (SELECT ...) AS Red
INNER JOIN
   (SELECT ...) AS Blue
ON Red.Status = Blue.Status
0
 

Author Comment

by:giggul
ID: 39219814
wow, that was easy.  THANKS !!!!!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question