Oracle SQL: Multiple Subqueries Unioned Without Running Original Query Multiple Times.

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-05-12T23:04:44Z Indexed on 2010/05/12 23:14 UTC
Read the original article Hit count: 173

Filed under:
|
|
|
|

So I've got a very large database, and need to work on a subset ~1% of the data to dump into an excel spreadsheet to make a graph. Ideally, I could select out the subset of data and then run multiple select queries on that, which are then UNION'ed together. Is this even possible? I can't seem to find anyone else trying to do this and would improve the performance of my current query quite a bit. Right now I have something like this:

SELECT (
     SELECT (
          SELECT(
                long list of requirements
          )
          UNION
          SELECT(
                slightly different long list of requirements
          )
     )
)

and it would be nice if i could group the commonalities of the two long requirements and have simple differences between the two select statements being unioned.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about sql