29. september 2002 - 18:09Der er
13 kommentarer og 1 løsning
læg tal sammen fra forskellige celler i en tabel - hvordan ???
Jeg er ved at lave lidt statistik til min side og ønsker en funktion som kan vise den procentvise visning af en bestem side i forhold til resten af siderne.
Dertil bruger jeg 2 celler i db'en: readcount & readcount_procent. Readcount_procent er jeg ikke sikker på er nødvendig.
Det hele virker bort set fra oplysningen om hvor mange kliks der har været total på alle siderne.
Så hvordan laver man en funktion som tæller værdien af alle readcount og lægger dem sammen til et heltal???
daniel>You dont say much at all about what fields you have in your table but I would suggest that you make a query in Access. There is a little button on the menu bar which looks like a Z (Totals) this will make a query where you can GROUP by for example SIDE and then SUM on the readCount field. Now in your ASP you can make a SELECT from this query WHERE side = what ever side your interested in seeing.
no_doubt: den løsning kan jeg ikke bruge til meget idet, det skal køre 100% dynamisk. Dvs. at mine sider kan variere i antal og dermed også i antallet af celler
Om databasen kan jeg sige at siderne ligger i en tabel (Articles) - hver side har naturligvis en celle og id for sig. Dertil hører en readcount. Jeg skal bruge readcount's værdi for n antal celler alt efter hvor mange sider(rækker) som er i databasen
Terry> No, I dont quite know how to. But I've tried with an sql sentense like this:
"SELECT COUNT(readcount) AS [Readcount_Procent] FROM Articles"
From devguru.com: SELECT COUNT(field) AS [expression] FROM table [WHERE ...] [GROUPBY ...] [HAVING ...]
The COUNT function is one of the aggregate functions that are used to calculate statistical information for a specified numeric field in a query. The other aggregate functions are: AVG, MAX, MIN, STDEV, STDEVP, SUM, VAR, VARP. Note that all of these functions return a single value.
The COUNT function simply counts how many values are in a field. Values which are NULL are included in the counting. If the field is just an empty set, COUNT returns zero.
This code finds the number of MediCare patients that were in the hospital on June 26, 2000 and stores that number into PatientCount. Note that the date format in Jet SQL is: #mm/dd/yyyy#
SELECT COUNT(Patients) AS [PatientCount] FROM MediCarePatients WHERE Date = #06/26/2000#
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.