Print Page | Close Window

Mode

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=2990
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Mode
Posted By: Mart
Subject: Mode
Date Posted: 24 May 2003 at 4:13am

How can I get the mode of a group of numbers in asp (1 2 3 4 or 5)

Thanks, Martin.




Replies:
Posted By: aero
Date Posted: 24 May 2003 at 3:54pm
what do u mean !???


Posted By: Gullanian
Date Posted: 24 May 2003 at 4:11pm

I assume he means which one is the most frequently occuring number, I dont know if any inbuilt functions, i think the only way to do it is create and array with a counter of how many of each number in each array slot, then loop through array

i=i+1

if arr(i) > arr(i) -  1 then

intMode = arr(I)

loop



Posted By: Mart
Date Posted: 25 May 2003 at 3:14am

Yes I want the most common number it is for a rating script, how do i use the script Gullanian posted?

Thanks, Martin.



Posted By: michael
Date Posted: 25 May 2003 at 9:49am

Well if you have the ratings in a database and want to get the mode it is fairly easy, you can do a query of the ratings as follows:
Select Top 1 count(rating) as mymode from tablename group by rating

This returns one number telling you what the mode of your dataset is.



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



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