Question : Oracle - replace union query

Is there any way we can use other statement to replace the query below?

Select 'mytext' as fieldB, count(distinct fieldA) from [mytable]
union Select 'mytext2' as fieldB, count(distinct fieldC) from [mytable]
Thanks

Answer : Oracle - replace union query

If you want your distinct counts to each show up on a different row,  you'll either need to do the union like you have, which I don't recommend because it's slow
or do a join like I have to a dummy table
or,  if you are on 11g you can try to use UNPIVOT.



none of them are complex.  but the union method is the least efficient.
Random Solutions  
 
programming4us programming4us