Multiple selects in one
From: The Magnet <art_at_unsu.com>
Date: Wed, 10 Mar 2010 13:49:19 -0800 (PST)
Message-ID: <5b68164a-ab2a-4de7-87d9-5cc96692bd43_at_g7g2000yqe.googlegroups.com>
I'm trying to write a query that will combine multiple rows from the same table into one row. That can be done with each column being a SELECT statement.
Date: Wed, 10 Mar 2010 13:49:19 -0800 (PST)
Message-ID: <5b68164a-ab2a-4de7-87d9-5cc96692bd43_at_g7g2000yqe.googlegroups.com>
I'm trying to write a query that will combine multiple rows from the same table into one row. That can be done with each column being a SELECT statement.
However, in my case each column has different criteria and I'm running into a problem where if any of the criteria from any of the queries is false, the entire query returns nothing.
SELECT customer_id, customer_name, new_order_id, old_order_id......... FROM (SELECT customer_id, customer_name, new_order_id
FROM...... WHERE........), (SELECT old_order_id FROM...... WHERE........)
Basically I'm applying separate criteria to each column. How can I allow any of the column queries to be false and just return NULL or whatever instead of the entire query failing? Received on Wed Mar 10 2010 - 15:49:19 CST