Is this the most efficient way...?
#4

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Theoretically, this should work: (credits)

Код:
SELECT COUNT('Email Address') AS NumOccurrences FROM Accounts HAVING ( COUNT(NumOccurrences) >= 1 )
(If that doesn't work, it's because of the two speech marks in the COUNT area, it works fine if you use one word without speech marks.)

You can just return the result, 0 if no, higher (or equal) 1 if so.

Also, a little tip: It's really not wise to use spaces for column names, it's more problematic. Use camel case.
Wouldn't the second query there be better?

Код:
SELECT email FROM users GROUP BY email HAVING ( COUNT(email) = 1 )
And thanks for the tip, I always wondered about that!
Reply


Messages In This Thread
Is this the most efficient way...? - by Scenario - 18.12.2011, 02:39
Re: Is this the most efficient way...? - by [HiC]TheKiller - 18.12.2011, 02:45
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 02:47
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 02:54
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 02:59
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 03:01
Re: Is this the most efficient way...? - by Calgon - 18.12.2011, 03:04
Re: Is this the most efficient way...? - by Scenario - 18.12.2011, 03:06
Re: Is this the most efficient way...? - by Lorenc_ - 18.12.2011, 03:06
Re: Is this the most efficient way...? - by jamesbond007 - 18.12.2011, 03:18

Forum Jump:


Users browsing this thread: 1 Guest(s)