Calculating with sql
От | Dennis Kaarsemaker |
---|---|
Тема | Calculating with sql |
Дата | |
Msg-id | afdeiv.214.1@kaarsemaker.nb.nu обсуждение исходный текст |
Ответы |
Re: Calculating with sql
|
Список | pgsql-sql |
I'm having trouble figuring out how to select something. This is the problem: From a copy of the CDDB-database i want to select the artist & album that has on average the longest tracks. But in the tracks table there is no such field as length, so i have to calculate it. But when i try to do so it just gives me errors. This is the erroneous query i have made so far select albums.ARTIST, albums.TITLE from tracks,albums where tracks.DISCID = albums.DISCID group by tracks.DISCID having(albums.LENGTH/count(tracks.TRACK)) = ( select max(albums.LENGTH/count(tracks.TRACK)) from tracks,albums where tracks.DISCID = albums.DISCID group by tracks.DISCID ); What is the correct way of selecting the album? -- Dennis K. ~.. It is impossible to make anything foolproof, .>>. because fools are so ingenious -Roger Berg-|\
В списке pgsql-sql по дате отправления: