Hi all,
I have an SQL query which works ok but missing the DOB (custom field) for those born before Unix (1970-01-01) and it also reports the day before given server is US but I'm in Adelaide.
SELECT u.firstname AS 'First Name', u.lastname AS 'Last name', DATE_FORMAT(FROM_UNIXTIME(uid.data), '%d-%m-%Y') AS DateofBirth,
u.email AS email, uid2.data AS 'LEA Site', c.idnumber AS 'System Code', c.shortname AS 'Module Completed',
DATE_FORMAT(FROM_UNIXTIME(ci.timecreated),'%d-%m-%Y') AS 'Certificate Date'
FROM prefix_course_completions AS p
JOIN prefix_course AS c ON p.course = c.id
JOIN prefix_user AS u ON p.userid = u.id
JOIN prefix_user_info_data AS uid ON uid.userid = u.id
JOIN prefix_user_info_field AS uif ON uid.fieldid = uif.id
JOIN prefix_user_info_data AS uid2 ON uid2.userid = u.id
JOIN prefix_user_info_field AS uif2 ON uid2.fieldid = uif2.id
JOIN prefix_simplecertificate_issues AS ci ON u.id = ci.userid
WHERE c.id=170 and uif.shortname = 'DOB' and uif2.shortname = 'School'
ORDER BY u.lastname
Any ideas on how to tweak the query to correct the above.
Thanks