----- Original Message -----
From: "Niall O Broin" <niall at linux.ie>
To: <ilug at linux.ie>
Sent: Saturday, September 01, 2001 3:36 PM
Subject: [ILUG] MySQL question
> Given two tables
>>> mysql> describe Customers;
> +--------------+-------------+------+-----+-----------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +--------------+-------------+------+-----+-----------+----------------+
> | Username | varchar(32) | | UNI | | |
> | Password | varchar(32) | YES | | NULL | |
> | ID | smallint(6) | | PRI | NULL | auto_increment |
> | Name | varchar(50) | | | | |
> +--------------+-------------+------+-----+-----------+----------------+
> 9 rows in set (0.00 sec)
>> mysql> describe Deliveries;
> +-------------+---------------+------+-----+------------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +-------------+---------------+------+-----+------------+-------+
> | Customer_ID | smallint(6) | | PRI | 0 | |
> | Picture_ID | int(11) | | PRI | 0 | |
> | Date | date | | PRI | 0000-00-00 | |
> | When | timestamp(14) | YES | | NULL | |
> +-------------+---------------+------+-----+------------+-------+
> 4 rows in set (0.00 sec)
>> How do I get a listing of Customers with the date of each customer's
latest
> delivery, ordered by the date ? I tried
>> select Name, max(Date) as Max from Customers, Deliveries order by Max;
group by deliveries.date?
>> but that tells me that
>> Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is
> illegal if there is no GROUP BY clause
> so I tried various combinations of GROUP BY with no great success. Can I
do I
> do this and if so, how (and given that it's MySQL, I hope the answer
doesn't
> involve subselects :-( )
>>>> Regards,
>jd
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!