I have 4 SQL queries that fetch data from the same table and I was wondering whether you can create a view containing multiple queries. For instance, one of these queries looks something like:
SELECT Count(COLUMN1) FROM TABLE1 WHERE COLUMN3 > '01-Oct-12' AND COLUMN3< '01-Nov-12'
whereas another looks like:
SELECT Count(COLUMN2) FROM TABLE1 WHERE COLUMN3 > '01-Oct-12' AND COLUMN3 < '01-Nov-12'
Thanks,
I.
The simplest implementation would be:
But if not all your queries use the same criteria you could use scalar sub-queries: