On Fri, Jul 25, 2008 at 12:27 AM, Michael Stearne <[EMAIL PROTECTED]> wrote: > I have a query: > > SELECT Country, COUNT( Country ) AS Cnt > FROM properties WHERE ( > Country != 'USA' AND > Country != 'US' AND > Country != 'Unit' AND > Country != 'United States' > AND Country != ' ' > AND Country IS NOT NULL ) > GROUP BY Country > ORDER BY Cnt > DESC LIMIT > > This is a costly query
I suggest that this is not a well normalized. I suggest that at a minium you should be using a 'Country' which would include a distinct entry for each country. If such a table exists a column could be added which would store a count of number of rows in the Properties table that reference the record in the Country table. This count could be maintained through your application, or via triggers if you are using MySQL 5.0 > . -- Rob Wultsch -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]