From: Martin Ramsch Date: March 12 1999 9:38pm Subject: Re: SQL question List-Archive: http://lists.mysql.com/mysql/135 Message-Id: <19990312223811.A21552@forwiss.uni-passau.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit On Fr, 1999-03-12 16:54:42 +0100, Harry Brückner wrote: > Now I want to select each article just once, where it has the amount > is the maximum. What you need is "GROUP BY", because you group all rows with the same Shop and Articles together and then sum up the Amount inside each group: SELECT Shop, Article, sum(Amount) FROM shop GROUP BY Shop, Article; > PS: Does anyone know a good SQL book which helps to get those little harder > SQL questions answered. Something like a "SQL Cookbook" or something ? The only (quote good) one I know about is: SQL Tutorial by James Hoffman Regards, Martin -- Martin Ramsch PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26 E4 EC 80 58 7B 31 3A D7