[thelist] can i merge columns in an Oracle query?
Jeremy Weiss
eccentric.one at gmail.com
Fri Mar 12 10:40:42 CST 2010
Short and sweet this time. I'm figuring the answer will be no, but
hoping I'm wrong. ;)
I've got a query similar to:
SELECT
all sorts of things
, WOSQ.DEPARTMENT AS SQUAWKSDEPARTMENT
, WOST.DEPARTMENT AS STEPSDEPARTMENT
FROM
11 tables all joined together
WHERE
sold within a certain date range
GROUP BY
all sorts of things
Now, I'm needing to order this query by department, but as you can see
I have two of them. So, right now I'm doing the following in my php
code
if (is_null($stepdept)) {
$department = $squawkdept; //never null
}else{
$department = $stepdept;
}
This gives me the department for that particular line item. But, by
this point, it's too late to group the results. Is there any way I
could merge the two departments in the query itself so that I could
group the query by department? The department will always be
STEPSDEPARTMENT unless it's null, then it's SQUAWKSDEPARTMENT.
Thanks.
-jeremy
More information about the thelist
mailing list