[EMAIL PROTECTED] ("Jerry Schwartz") wrote in
news:[EMAIL PROTECTED]: 

> SELECT book_author, GROUP_CONCAT(book_title) AS book_title GROUP BY
> book_author WHERE book_title LIKE "<something>";
>  
> This actually seems to work, but it makes me ill to look at it. 

I doubt this works: there is no FROM clause, and the WHERE and GROUP BY 
clauses are in the wrong order.

The following will work:

SELECT book_author, GROUP_CONCAT(book_title) AS book_title
FROM foo
WHERE book_title LIKE '<SOMETHING>'
GROUP BY book_author

but the book_title in the WHERE clause is *not* the alias but the 
individual column. Results of an aggregate function are *never*  
available in a WHERE clause. 

You need a HAVING clause.

-- 
felix

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to