Skip to main content
Tweeted twitter.com/#!/StackDBAs/status/108065206797733889
edited body
Source Link
Jack Douglas
  • 40.2k
  • 15
  • 104
  • 177

I have the following query which works for me:

select count(*)
from (
   select UNIQUE col1, col2, col3
   from my_table
   where cond1 = 'A'
   and cond2 = 'B'
   and cond3 = 'C'
})

Is it possible to write this without the nested query?

I have the following query which works for me:

select count(*)
from (
   select UNIQUE col1, col2, col3
   from my_table
   where cond1 = 'A'
   and cond2 = 'B'
   and cond3 = 'C'
}

Is it possible to write this without the nested query?

I have the following query which works for me:

select count(*)
from (
   select UNIQUE col1, col2, col3
   from my_table
   where cond1 = 'A'
   and cond2 = 'B'
   and cond3 = 'C'
)

Is it possible to write this without the nested query?

Source Link
demongolem
  • 187
  • 1
  • 3
  • 9

Shortest Query to Combine Count and Unique (Oracle)

I have the following query which works for me:

select count(*)
from (
   select UNIQUE col1, col2, col3
   from my_table
   where cond1 = 'A'
   and cond2 = 'B'
   and cond3 = 'C'
}

Is it possible to write this without the nested query?