saquery.com
a web developer' s kung fu…
List Subselect in MySql
Categories: Snippets
The following sample shows how to limit a GROUP_CONCAT string in MySql to a specific length. This methode is near to the better List Aggregate Function in Sybase SqlAnywhere
SELECT
SUBSTRING_INDEX(
GROUP_CONCAT( concat( '<a href="\&quot;#\&quot;">',w.songname,'</a>' ) ORDER BY downloaded DESC SEPARATOR ', ')
,', ',2) SONGLIST,
sum(downloaded) DONWLOADS ,
count(*) NUMBER_OF_SONGS FROM SONGS w
group by artist
order by downloads desc
limit 100

Vote this page

Leave a Reply