Felix Geerinckx wrote:
[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.
Ahh indeed, I was only looking at the aliasing of the group concat
function. :)
Teach me for skimming emails!
Mark
--
Mark Leith, Support Engineer
MySQL AB, Worcester, England, www.mysql.com
Are you MySQL certified? www.mysql.com/certification
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]