| | |
ASP- SQL Server..Query help....
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello,
I am using ASP and MS SQL Sever 2000 as backend database..
I am writing a SQL query which will pick up top 5 recipes details who have scored the highest marks from the following table
tblrecipes -
The following points to be noted:
- The table has 500 records.
- 50 of them have achieved the highest marks ie 100 marks each
- My following query is picking up top 5 records who have scored 100 marks
and getting this output:
http://img2.freeimagehosting.net/uploads/3d14a5272a.jpg
Now my question is:
On what basis its showing up this sequence of listing? I mean why the ID 89 is on the top and 136 at the bottom? Why the ID is not the other way round?
Like the following?
ID
__
178
136
89
286
340
Can someone explain please?
Thanx
I am using ASP and MS SQL Sever 2000 as backend database..
I am writing a SQL query which will pick up top 5 recipes details who have scored the highest marks from the following table
tblrecipes -
ASP Syntax (Toggle Plain Text)
ID | recipe_name | Total
The following points to be noted:
- The table has 500 records.
- 50 of them have achieved the highest marks ie 100 marks each
- My following query is picking up top 5 records who have scored 100 marks
ASP Syntax (Toggle Plain Text)
SELECT TOP 5 ID, total, recipe_name FROM tblrecipes ORDER BY total DESC
and getting this output:
http://img2.freeimagehosting.net/uploads/3d14a5272a.jpg
Now my question is:
On what basis its showing up this sequence of listing? I mean why the ID 89 is on the top and 136 at the bottom? Why the ID is not the other way round?
Like the following?
ID
__
178
136
89
286
340
Can someone explain please?
Thanx
•
•
Join Date: Sep 2004
Posts: 89
Reputation:
Solved Threads: 1
Try
The thing is that you haven't manetioned to sort the ID colums as well. So IDs appear in the order of last modified data/time.
ASP Syntax (Toggle Plain Text)
SELECT TOP 5 ID, total, recipe_name FROM tblrecipes ORDER BY total DESC, ID DESC
The thing is that you haven't manetioned to sort the ID colums as well. So IDs appear in the order of last modified data/time.
![]() |
Similar Threads
- How i Can connect Sql Server with ASP (ASP)
- Freelance Web designer PHP, MySQL, ASP, SQL Server 2000 (Post your Resume)
- ASP/SQL - Problem (ASP)
- Freelance Web designer PHP, MySQL, ASP, SQL Server 2000 (Web Development Job Offers)
- Professional Freelance Web designer India PHP MySQL ASP SQL Server (Community Introductions)
- How to connect ASP with sql server ? (Community Introductions)
Other Threads in the ASP Forum
- Previous Thread: Where can I get a Library of std ASP functions
- Next Thread: error '80020009' Exception occurred.
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





