Re: HAVING vs. WHERE

2003-03-05 Thread Dan Nelson
In the last episode (Mar 05), Jonathan Arnold said: > In the MySQL reference, it warns against using HAVING for items that > "should" be in a WHERE clause. I'm not sure what items "should" be in > a WHERE clause. The WHERE clause is used to restrict records, and is also used by the query optimizer

Re: HAVING vs. WHERE

2003-03-05 Thread Benjamin Pflugmann
On Wed 2003-03-05 at 11:17:37 -0500, [EMAIL PROTECTED] wrote: > In the MySQL reference, it warns against using HAVING for items > that "should" be in a WHERE clause. I'm not sure what items > "should" be in a WHERE clause. Everything except stuff that only works when it's in the HAVING clause. The

Re: HAVING vs. WHERE

2003-03-05 Thread Tore Bostrup
HAVING is for qualifying result rows based on the value of aggregate functions, WHERE is for qualifying result rows based on individual (column) values. So in you case you should use WHERE. Although useful in the right situation, HAVING is used much less than a WHERE clause. One example of how t

Re: HAVING vs. WHERE

2003-03-05 Thread Paul DuBois
At 11:17 -0500 3/5/03, Jonathan Arnold wrote: In the MySQL reference, it warns against using HAVING for items that "should" be in a WHERE clause. I'm not sure what items "should" be in a WHERE clause. If a test can be in either clause, put it in the WHERE clause. The principle is that the sooner y

Re: HAVING vs. WHERE

2003-03-05 Thread Stanimir Dzharkalov
go to http://www.mysql.com/doc/en/Miscellaneous_functions.html and take a look at inet_ntoa and inet_aton you may store IP addresses as integers and the query will be SELECT inet_aton(inetAdr), * FROM Client WHERE inetAdr < inet_aton('240.0.0.0') OR inetAdr>inet_aton('239.255.255.255') the inet