I have two similar queries on same table and same where condition but different selects on it.
Select flatpos from archdetails
where version='1.3' AND compname IN (
select distinct compname from svn3 where revno='r270294'
)
AND
select count(distinct compname),
sum(CASE WHEN inFlat=1 THEN 1 ELSE 0 END),
min(flatLoopIndex)
from archdetails
where version='1.3'
AND compname IN (
select distinct compname from svn3 where revno='r270294'
)
As you can see the query is on the same table archdetails
and where condition is same for both as well.
query 1 will output something like
12
47
query 2 will output something like
396 43 1
I would like the output to be
12 396 43 1
47 396 43 1
I cannot obviously combine them by a group by.
Each one of these query runs in x amount of time. I know I can just put these queries into the from clause of a new query and get the desired result but then the new query runs in 2x amount of time.
Is there a faster way around since database essentially has to be scanned just once and then it is just a matter of formatting.
Thanks