Index: openacs-4/packages/bookmarks/www/most-popular-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/most-popular-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/most-popular-postgresql.xql 9 Sep 2001 00:00:30 -0000 1.1 +++ openacs-4/packages/bookmarks/www/most-popular-postgresql.xql 9 Sep 2001 00:24:01 -0000 1.2 @@ -7,9 +7,7 @@ -select distinct host_url, - ( - select count(*) +select host_url, count(*) as n_bookmarks from ( select o2.bookmark_id, o2.url_id @@ -19,10 +17,9 @@ and o2.tree_sortkey >= o1.tree_sortkey and o2.tree_sortkey like (o1.tree_sortkey || '%') order by o2.tree_sortkey - ) b - where b.url_id = bm_urls.url_id - and acs_permission__permission_p(b.bookmark_id, :browsing_user_id, 'read') = 't') as n_bookmarks -from bm_urls + ) b join bm_urls using (url_id) + where acs_permission__permission_p(b.bookmark_id, :browsing_user_id, 'read') = 't' +group by host_url order by n_bookmarks desc @@ -32,10 +29,8 @@ - select coalesce(url_title, complete_url) as local_title, - complete_url, - ( - select count(*) + select complete_url as local_title, + complete_url, count(*) as n_bookmarks from ( select o2.bookmark_id, o2.url_id @@ -45,10 +40,9 @@ and o2.tree_sortkey >= o1.tree_sortkey and o2.tree_sortkey like (o1.tree_sortkey || '%') order by o2.tree_sortkey - ) b - where b.url_id = bm_urls.url_id - and acs_permission__permission_p(b.bookmark_id, :browsing_user_id, 'read') = 't') as n_bookmarks - from bm_urls + ) b join bm_urls using (url_id) + where acs_permission__permission_p(b.bookmark_id, :browsing_user_id, 'read') = 't' +group by complete_url, local_title order by n_bookmarks desc