Howdy. Hope I have the right forum for this question.
I'm on a project using a SQLite database in Flex 4 and I'm using the following SQL query:
SELECT max(totalScore) AS score,
max(longestStreak) AS streakLen,
max((correctNotes * 100) / totalNotes) AS accuracyPercent
FROM main.practiceRecord rec
JOIN main.lessonSession sess
ON rec.sessionGuid = sess.guid
WHERE sess.purchasedLessonID = :lessonId
The query is working fine as it is written. The problem is that when I do the calculation ((correctNotes * 100) / totalNotes) to return a percent value, I'd like to do it without having to multiply by 100, since I generally treat percentages as numbers between 0 and 1 (.68 = 68%). If I don't multiple by 100 in the query, however, I get a "0" for anything less than 1, so only 100% returns with the correct value. It appears that this kind of calculation only returns an int, as opposed to a REAL (or its AS3 corresponding "Number").
Is there something that I can do to return a value between 0 and 1 for this percentage so that I don't have to multiply by 100 in the query and then divide by 100 when I get the result? Is there a function that allows me to specify the precision for the returned value?
Thanks for your time,