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

On Friday 25 July 2003 17:38, Alec Smith wrote:
>
> But what I really need is a result like
>
> +----------+------------+
>
> | name     | domain     |
>
> +----------+------------+
>
> | hostdom1 | abc123.com |
> | hostdom2 | abc127.com |
> | hostdom3 | abc128.com |
> | hostdom4 | abc129.com |
>
> +----------+------------+
>
> where only the t.name and d.domain pair with the highest
> domain_id for each type_id are given. Is there a way to do this without
> resulting to seperate SQL queries for each entry in the domain_types
> table? I'm using MySQL 4.0.14 on FreeBSD 5.1.

Try:

        Select name, max(domain)
        From domain_types dt join domains d on dt.type_id = d.type_id
        group by name;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/I9rMjeziQOokQnARAgCyAJ4ze6xcJXUqUqT3kUzoXNSLNq7hjACfTpgu
g5Kk/tINNr0GIt5rIbaJX7k=
=m37K
-----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