Author Topic: Comparing a subquery with a constant  (Read 672 times)

0 Members and 1 Guest are viewing this topic.

Offline SepphTopic starter

  • Irregular
  • Posts: 10
    • View Profile
Comparing a subquery with a constant
« on: February 01, 2010, 07:13:54 AM »
Hi, is it corrent to write

(<subquery here>) <op> <constant>?

I.e. WHERE (SELECT COUNT(*) FROM Employees) > 10 <- WRONG?

I have read this is wrong and only <constant> <op> (<subquery>) works

I.e.  10 < WHERE (SELECT COUNT(*) FROM Employees)

Is there a difference between MSSQL and MySQL related to this?

Offline corbin

  • Guru
  • Freak!
  • *
  • Posts: 7,951
  • Gender: Male
    • View Profile
Re: Comparing a subquery with a constant
« Reply #1 on: February 02, 2010, 08:31:19 PM »
Order shouldn't matter.
Why doesn't anyone ever say hi, hey, or whad up world?

Offline SepphTopic starter

  • Irregular
  • Posts: 10
    • View Profile
Re: Comparing a subquery with a constant
« Reply #2 on: March 06, 2010, 08:22:59 AM »
I've been going through the Oracle Database Programmer Course and it does mention subqueries must be on the right side of a comparison.

Maybe this rule applies to Oracle only?