Using a self join to select the rows with the maxium values per group

posted: June 1st, 2006 · by: Sven

in: Programming · tagged as: , , , , ·  7 comments »

Phew. This really baffled me. I use SQL for *years* now … but I haven’t been able to come up with a working statement for a query that I’ve thought to be a really trivial thing at first.

Like this:

I have a table articles which can belong to blogs. But blogs are subclasses of an abstract type called location. Thus, each article holds a key to the table locations where there is a column type, which will have the value ‘blog’ for each concrete blog.

Read the rest of this entry

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany


http://www.artweb-design.de

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97