-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 20 July 2003 22:59, Tanamon wrote:
> +----+-----------+--------------+
>
> | id | file_name | max(version) |
>
> +----+-----------+--------------+
>
> |  6 | ffour     |            2 |
> |  1 | fone      |            3 |
> |  5 | fthree    |            1 |
> |  2 | ftwo      |            2 |
>
> +----+-----------+--------------+
> 4 rows in set (0.02 sec)
>
> The query below returns the empty set.
>
> mysql> select id, file_name, max(version) from test group by file_name
> having max(version);
> Empty set (0.00 sec)

Try this:
        Select id, file_name, max(version) from test group by file_name;

The "having" clause in your query is redundant as the max() aggregate already 
limits it to the maximum value.

- ---Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/G8GujeziQOokQnARArVPAJ9TdchBj8tExxitns8PkRSnGbMFugCgmhTW
et7HpBp07nWh+KD//xqDLbM=
=p8/8
-----END PGP SIGNATURE-----


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

Reply via email to