Database Help

  • Thread starter Thread starter Debbie
  • Start date Start date
D

Debbie

I need a page to display a list of distinct records with a
count beside each one. I used the following in a custom
query and it works great. I just want it to "order" them
by the count. Anyway to do this? I tried changing the
order by to "pagecnt" but I get a too few paremeters error.

SELECT dt.page, Sum(1) AS pagecnt
FROM dt
GROUP BY dt.page
ORDER BY dt.page;
 
Try ORDER BY dt.page, Sum(1);

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Debbie said:
Didn't work. I didn't get an error but it didn't sort by
count.

It should have, within dt.page. Perhaps this is what you want:

ORDER BY Sum(1), dt.page;

or this:

ORDER BY Sum(1) DESC, dt.page;

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Back
Top