close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

COUNT(*) Function

Thread began 9/03/2015 5:19 am by salaroche | Last modified 10/05/2015 2:31 pm by salaroche | 974 views | 21 replies

salaroche

Ray:

Thank you for your reply. Still, I don’t see any indication showing the records that don’t have any Absence in the Attendance column. The idea is to show ALL records, except that those records that have an “Absent” characteristic need to have the percentage calculation performed on them. The rest of the records would need to show a 100 % attendance.

I have been Googling around for solutions and, as usual, I've found some good hints at W3schools.com that tend to reinforce a previous idea about this. I doubt the syntax I’ve written below is correct, but what I would ideally like to do with it is to SELECT all records from oxadmain and perform the COUNT() functions and Math calculations only WHEN the records contain an Absent instance in the Attendance field, and store the results in the variable Percentage. ELSE enter the value of “100” as Percentage.

I hope my idea makes sense to you.

SELECT *

CASE
WHEN attendance = Absent THEN SELECT Count(*) AS ClassDays, (SELECT Count(*) FROM oxadmain WHERE studentID = nestidparam AND Absent = 1) AS ClassAbsent, ROUND ((ClassAbsent/ClassDays)*100, 2) AS Percentage
ELSE
Percentage = “100”
END
FROM oxadmain
ORDER BY name ASC

Would something like the above work?

NOTE: It isn't clear to me whether the first COUNT(*) is counting ALL the records in the table or only the number of records per student. The COUNT needed would be that of records (total class-days) per student.

Any suggestions would be highly appreciated.

Thank you for your attention

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...