Create SQL.sql

This commit is contained in:
Siwat Sirichai 2023-11-13 19:55:36 +07:00
parent 0e6a41d6e5
commit 8082c08244
1 changed files with 16 additions and 0 deletions

16
SQL.sql Normal file
View File

@ -0,0 +1,16 @@
#Get S-P Access
USE face_detect;
-- Get Student Access
SELECT `access-log`.id , `students`.name as `student_name`, `parents`.name as `parents_name`, `access-log`.`timestamp`
FROM face_detect.`access-log`
JOIN parents ON `access-log`.parent_id = `parents`.id
JOIN students ON `access-log`.student_id = `students`.id
ORDER BY `access-log`.`timestamp` ASC;
-- Get Parents Accesses
SELECT `access-log`.id, `parents`.name as `parents_name`, `access-log`.`timestamp`
FROM face_detect.`access-log`
JOIN parents ON `access-log`.parent_id = `parents`.id
WHERE `access-log`.student_id IS NULL
ORDER BY `access-log`.`timestamp` ASC;