Re: New plugin: Custom reports

Re: New plugin: Custom reports

by Jeremy Schweitzer -
Number of replies: 1
Picture of Plugin developers Picture of Testers

Can anyone see what I'm doing wrong? I've pasted my SQL Query below. It generates the report that I want (shows the certificates for the currently logged in user, including course, verfication code, CEUs, education hours, and date), but for some reason every instance of a certificate is reported six times. We're using MySQL.

SELECT
prefix_certificate_issues.classname AS Course,
prefix_certificate.name AS Certificate,
prefix_certificate_issues.studentname AS Name,
prefix_certificate_issues.code AS 'Verification Code',
prefix_certificate.eduhours AS CEUs,
prefix_certificate.printhours AS Hours,
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), '%m/%d/%Y' ) AS Date

FROM
prefix_certificate_issues
 
INNER JOIN prefix_user_info_data
ON prefix_certificate_issues.userid = prefix_user_info_data.userid
 
INNER JOIN prefix_certificate
ON prefix_certificate_issues.certificateid = prefix_certificate.id

WHERE
prefix_user_info_data.userid = %%USERID%%

Average of ratings: -
In reply to Jeremy Schweitzer

Re: New plugin: Custom reports

by Jeremy Schweitzer -
Picture of Plugin developers Picture of Testers

I fixed it. I change SELECT to SELECT DISTINCT and now it works fine.