When I try this: 

SELECT article, dealer, price
FROM   shop s1
WHERE  price=(SELECT MAX(s2.price)
              FROM shop s2
              WHERE s1.article = s2.article) LIMIT 0, 100
 
I got this error message:
 
You have an error in your SQL syntax near 'SELECT MAX(s2.price)
              FROM shop s2
              WHERE s1.article' at line 3
 
 
My shop table contains this data:
+---------+--------+-------+

| article | dealer | price |

+---------+--------+-------+

|    0001 | A      |  3.45 |

|    0001 | B      |  3.99 |

|    0002 | A      | 10.99 |

|    0003 | B      |  1.45 |

|    0003 | C      |  1.69 |

|    0003 | D      |  1.25 |

|    0004 | D      | 19.95 |

+---------+--------+-------+

 

 

and the table was created with this commnad:

 

CREATE TABLE shop (

 article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,

 dealer  CHAR(20)                 DEFAULT ''     NOT NULL,

 price   DOUBLE(16,2)             DEFAULT '0.00' NOT NULL,

 PRIMARY KEY(article, dealer));

 

 

Thank You !




---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to