|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Dreamweaver - ASP Error showing Recordset
Hi,
I have 3 questions, 1. Only show 10 highest records used by the Sums 2. Sort by the Sums 3. Display these in a table I know I can use the repeat region for 10 records only but would like only display the top 10 records in order of cost (sums). I have a column that has various 'Cost Codes' from departments, and 6 other columns that data faults, voice faults etc that are summed to create 'Sum', I am not sure whether I have done this correctly, SELECT appold.`Cost Code`, SUM((appold.`Data Units` + (appold.`Voice Units` + (appold.`Data Faults` + (appold.`Voice Faults` + (appold.Telephone + appold.Survey)))))) AS Sums FROM appold GROUP BY appold.`Cost Code` ORDER BY 1 ASC, appold.`Cost Code` DESC when I click test in the recordset window I see (what is expected) but not in sort order of the Sums: 0840867001 87 0840867002 1352 etc but when I drag the 'Cost Code' and 'Sums' to a table and use repeat region, it only shows the last record repeated throughout the table? Also, I'm not sure of how to create the query for only top ten records. Regards, Sanjay |
|
#2
|
|||
|
|||
|
I assume that you are using Mysql
Code:
SELECT appold.`Cost Code`, SUM(appold.`Data Units` + appold.`Voice Units` + appold.`Data Faults` + appold.`Voice Faults` + appold.Telephone + appold.Survey) AS Sums FROM appold GROUP BY appold.`Cost Code` ORDER BY Sums desc , appold.`Cost Code` DESC limit 10 |
|
#3
|
|||
|
|||
|
Thanks SwampBoogie for replying,
No I'm using Dreamweaver ASP VBScript to a Access Database. Regards, Sanjay |
|
#4
|
|||
|
|||
|
Why the ` then?
Code:
SELECT top 10 appold.[Cost Code], SUM(appold.[Data Units] + appold.[Voice Units] + appold.[Data Faults] + appold.[Voice Faults] + appold.Telephone + appold.Survey) AS Sums FROM appold GROUP BY appold.[Cost Code] ORDER BY 2 desc , 1 DESC |
|
#5
|
|||
|
|||
|
hey Swampboogie thats cool!
I don't know when you should ' and [] - what's the difference? Also, I'm using this programme that creates a chart from the SQL query, but I get this error: Error(-2147217900):[Microsoft][ODBC Microsft Access Driver] Syntax error (missing operator) in query expression... Have you seen this before? Thanks again, Sanjay Last edited by sanj : April 8th, 2003 at 06:58 PM. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Dreamweaver - ASP Error showing Recordset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|