[thelist] sql sum() / group by / left join problem

elin tjerngren. artopod elin at artopod.se
Wed Sep 3 08:04:45 CDT 2003


Hi,

> one of the additional tables (genre?) has multiple rows per artist
[...]
> however, it might be better to resolve how you intend to display the artist
> three times instead of once

Genre *was* represented three times per artist before, but now we only use 
one genre per artist...(but I decided to keep the extra table for some 
reason...). You've helped me to see the problem - in some cases artists 
has three entries in the artists_genres table 
- that's when the sum is x 3..  
But I don't want the artists to show three times of course...

> and don't forget, every non-aggregate column in the SELECT list has to be
> included in the GROUP BY

Not sure what you mean, but it didn't help with this either...
	 group by artists.id_no,artists_genres.artist_no

..I guess I'll either have to skip the extra tables for genres or go for 
the temp table... 

Thanks,

/Elin, http://artopod.com





More information about the thelist mailing list