[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Select and =MAX()
Hi,
What version of MySQL are you using ?
How is price defined ? .. In the below example, I defined price as
float(9,2).
mysql> SELECT *
-> FROM a;
+-------+
| price |
+-------+
| 19.95 |
| 10.99 |
| 3.99 |
| 3.45 |
| 1.69 |
| 1.45 |
| 1.25 |
+-------+
7 rows in set (0.01 sec)
mysql> SELECT price
-> FROM a
-> HAVING price=MAX(price);
+-------+
| price |
+-------+
| 19.95 |
+-------+
1 row in set (0.01 sec)
mysql>
Regards,
Jorge
For technical support contracts, visit https://order.mysql.com/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Jorge del Conde <jorge@xxxxxxxxx>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Mexico City, Mexico
<___/ www.mysql.com
-----Original Message-----
From: bobby [mailto:bobby] On Behalf Of R Talbot
Sent: Wednesday, June 27, 2001 8:21 PM
To: mysql@xxxxxxxxxxxxxxx; jorge@xxxxxxxxx
Subject: RE: Select and =MAX()
Jorge
When I issue your suggested commands here are the resulted rows..
mysql> SELECT price
-> FROM shop
-> HAVING price=MAX(price);
Empty set (0.01 sec)
But when I issue...
mysql> select price from shop order by price desc;
+-------+
| price |
+-------+
| 19.95 |
| 10.99 |
| 3.99 |
| 3.45 |
| 1.69 |
| 1.45 |
| 1.25 |
+-------+
7 rows in set (0.01 sec)
Why??
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread77885@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail
<mysql-unsubscribe-jorge_mysql_general=yahoo.com@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread77886@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.