Print Page | Close Window

Sql: Top 5

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7473
Printed Date: 01 April 2026 at 12:59am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Sql: Top 5
Posted By: ngaisteve1
Subject: Sql: Top 5
Date Posted: 21 November 2003 at 8:57pm
This is about sql. I know that to display first 5 (highest hit)query, I need to use TOP 5 but I encounter a problem where two records has similar count. Eg,

Apple = 4
Orange = 7
Banana = 3
Mango = 3
Coconut = 6
Pineapple = 5

The result come out is 6 records instead of 5 because banana and mango are same. Anyway, I can solve this problem. How do you guys usually deal with this problem rarely happens I think? Just display 4 or still display 5 records but the last one is random basis or how.



Replies:
Posted By: michael
Date Posted: 21 November 2003 at 10:16pm
I leave it at the number defined unless critical that noone is left out I'd create a SP to dynamically get another number.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Bluefrog
Date Posted: 24 November 2003 at 6:42am
I'd ORDER BY and just eliminate something.

-------------
http://renegademinds.com/" rel="nofollow - Renegade Minds - Guitar Software http://renegademinds.com/Default.aspx?tabid=65" rel="nofollow - Slow Down Music



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net