From 22551cb940455ef71d5682e53cf3b03698e2f3ea Mon Sep 17 00:00:00 2001 From: MonkeyHiko <53597124+MonkeyHiko@users.noreply.github.com> Date: Tue, 31 Mar 2020 13:13:18 +0700 Subject: [PATCH] New Query for Fetch Data New Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch DataNew Query for Fetch Data #dirumahaja #plsacc #accmin --- ProjectAbsenTelkom2/Database/README.md | 3 +- ProjectAbsenTelkom2/Database/admin_queries.py | 246 +++++++++++++++++ .../Database/non_admin_queries.py | 255 ++++++++++++++++++ .../~$$Flowchart Projek Absensi.~vsdx | Bin 4096 -> 0 bytes 4 files changed, 503 insertions(+), 1 deletion(-) create mode 100644 ProjectAbsenTelkom2/Database/admin_queries.py create mode 100644 ProjectAbsenTelkom2/Database/non_admin_queries.py delete mode 100644 ProjectAbsenTelkom2/Prototype/Pemodelan Perangkat Lunak/~$$Flowchart Projek Absensi.~vsdx diff --git a/ProjectAbsenTelkom2/Database/README.md b/ProjectAbsenTelkom2/Database/README.md index 8b9ccbf..1e05af0 100644 --- a/ProjectAbsenTelkom2/Database/README.md +++ b/ProjectAbsenTelkom2/Database/README.md @@ -1,3 +1,4 @@ DATABASE - MYSQL -Tulis catatan dibawah ini: \ No newline at end of file +Tulis catatan dibawah ini: +Jika terdapat kekurangan query, tolong langsung hubungi saya - Nathan : 20188107@student.smktelkom-jkt.sch.id \ No newline at end of file diff --git a/ProjectAbsenTelkom2/Database/admin_queries.py b/ProjectAbsenTelkom2/Database/admin_queries.py new file mode 100644 index 0000000..afc3102 --- /dev/null +++ b/ProjectAbsenTelkom2/Database/admin_queries.py @@ -0,0 +1,246 @@ +from test1.models import * + +##INSERT + +#kelas +# INSERT INTO tbl_kelas (id_kelas, nama_kelas) VALUES ('id_kelas', 'nama_kelas') + +id_kelas = 'id_kelas' +nama_kelas = 'nama_kelas' + +#ini force INSERT +Tbl_kelas.objects.create(id_kelas=id_kelas, nama_kelas=nama_kelas) + +# yg dibawa ini vvv jadi INSERT (kalau pk nya belom ada di database) +# atau UPDATE (kalau pk nya udah ada di database) +# buat INSERT pakai yang force insert ^^^ + +# insert = Tbl_kelas() +# insert.id_kelas = id_kelas +# insert.nama_kelas = nama_kelas +# insert.save() + +#siswa +# INSERT INTO tbl_siswa (id_siswa, id_kelas, nama_siswa, email_siswa, password_siswa) VALUES ('id_siswa', 'id_kelas', 'nama_siswa', 'email_siswa', 'password_siswa') + +id_siswa = 'id_siswa' +id_kelas = 'id_kelas' +nama_siswa = 'nama_siswa' +email_siswa = 'email_siswa' +password_siswa = 'password_siswa' + +#ini force INSERT +Tbl_siswa.objects.create(id_siswa=id_siswa, id_kelas=Tbl_kelas.objects.get(id_kelas=id_kelas), nama_siswa=nama_siswa, email_siswa = email_siswa, password_siswa = password_siswa) + +# insert = Tbl_siswa() +# insert.id_siswa = id_siswa +# insert.id_kelas = Tbl_kelas.objects.get(id_kelas=id_kelas) +# insert.nama_siswa = nama_siswa +# insert.email_siswa = email_siswa +# insert.password_siswa = password_siswa +# insert.save() + +#akses +# INSERT INTO tbl_akses (id_akses, nama_akses) VALUES ('id_akses', 'nama_akses') + +id_akses = 'id_akses' +nama_akses = 'nama_akses' + +Tbl_akses.objects.create(id_akses=id_akses, nama_akses=nama_akses) + +# insert = Tbl_akses() +# insert.id_akses = id_akses +# insert.nama_akses = nama_akses +# insert.save() + +#guru +# INSERT INTO tbl_guru (id_guru, nama_guru, email_guru, password_guru, id_akses) VALUES ('id_guru', 'nama_guru', 'email_guru', 'password_guru', 'id_akses') + +id_guru = 'id_guru' +nama_guru = 'nama_guru' +email_guru = 'email_guru' +password_guru = 'password_guru' +id_akses = 'id_akses' + +Tbl_guru.objects.create(id_guru=id_guru, nama_guru=nama_guru, email_guru=email_guru, password_guru=password_guru, id_akses=id_akses) + +# insert = Tbl_guru() +# insert.id_guru = id_guru +# insert.nama_guru = nama_guru +# insert.email_guru = email_guru +# insert.password_guru = password_guru +# insert.id_akses = id_akses +# insert.save() + +#kategori +# INSERT INTO tbl_kategori (id_kategori, nama_kategori) VALUES ('id_kategori', 'nama_kategori') + +id_kategori = 'id_kategori' +nama_kategori = 'nama_kategori' + +Tbl_kategori.objects.create(id_kategori=id_kategori, nama_kategori=nama_kategori) + +# insert = Tbl_kategori() +# insert.nama_kategori = id_kategori +# insert.nama_kategori = nama_kategori +# insert.save() + +#nama acara +# INSERT INTO tbl_nama_acara (id_nama_acara, id_kategori, nama_acara) VALUES ('id_nama_acara', 'id_kategori', 'nama_acara') + +id_nama_acara = 'id_nama_acara' +id_kategori = 'id_kategori' +nama_acara = 'nama_acara' + +Tbl_kategori.objects.create(id_nama_acara=id_nama_acara, nama_kategori=nama_kategori, nama_acara=nama_acara) + +# insert = Tbl_nama_acara() +# insert.id_nama_acara = id_nama_acara +# insert.id_kategori = id_kategori +# insert.nama_acara = nama_acara +# insert.save() + +#acara +# INSERT INTO tbl_acara (id_acara, id_nama_acara, waktu_acara) VALUES ('id_acara', 'id_nama_acara', 'waktu_acara') + +id_acara = 'id_acara' +id_nama_acara = 'id_nama_acara' +waktu_acara = 'waktu_acara' + +Tbl_acara.objects.create(id_acara=id_acara, id_nama_acara=id_nama_acara, waktu_acara=waktu_acara) + +# insert = Tbl_acara() +# insert.id_acara = id_acara +# insert.id_nama_acara = id_nama_acara +# insert.waktu_acara = waktu_acara +# insert.save() + +#jampel +# INSERT INTO tbl_jampel (id_jampel, nama_jampel, waktu_jampel) VALUES ('id_jampel', 'nama_jampel', 'waktu_jampel') + +id_jampel = 'id_jampel' +nama_jampel = 'nama_jampel' +waktu_jampel = 'waktu_jampel' + +Tbl_jampel.objects.create(id_jampel=id_jampel, nama_jampel=nama_jampel, waktu_jampel=waktu_jampel) + +# insert = Tbl_jampel() +# insert.id_jampel = id_jampel +# insert.nama_jampel = nama_jampel +# insert.waktu_jampel = waktu_jampel +# insert.save() + + + +##UPDATE +# hati hati kalau update +# jika id nya berubah dan belum ada di database maka dia INSERT + +#kelas +# UPDATE tbl_kelas SET nama_kelas='$nama_kelas' WHERE id_kelas='$id_kelas'; + +update = Tbl_kelas.objects.get(id_kelas=id_kelas) +update.nama_kelas = nama_kelas +update.save() + +#siswa +# UPDATE tbl_siswa SET id_kelas='$id_kelas', nama_siswa='$nama_siswa', email_siswa='$email_siswa', password_siswa='$password_siswa' WHERE id_siswa='$id_siswa'; + +update = Tbl_siswa.objects.get(id_siswa=id_siswa) +update.id_kelas = Tbl_kelas.objects.get(id_kelas=id_kelas) +update.nama_siswa = nama_siswa +update.email_siswa = email_siswa +update.password_siswa = password_siswa +update.save() + +#akses +# UPDATE tbl_akses SET nama_akses='$nama_akses' WHERE id_akses='$id_akses'; + +update = Tbl_akses.objects.get(id_akses=id_akses) +update.nama_akses = nama_akses +update.save() + +#guru +# UPDATE tbl_guru SET nama_guru='$nama_guru', email_guru='$email_guru', password_guru='$password_guru', id_akses='$id_akses' WHERE id_guru='$id_guru'; + +update = Tbl_guru.objects.get(id_guru=id_guru) +update.nama_guru = nama_guru +update.email_guru = email_guru +update.password_guru = password_guru +update.id_akses = id_akses +update.save() + +#kategori +# UPDATE tbl_kategori SET nama_kategori='$nama_kategori' WHERE id_kategori='$id_kategori'; + +update = Tbl_kategori.objects.get(id_kategori=id_kategori) +update.nama_kategori = nama_kategori +update.save() + +#nama acara +# UPDATE tbl_nama_acara SET id_kategori='$id_kategori', nama_acara='$nama_acara' WHERE id_nama_acara='$id_nama_acara'; + +update = Tbl_nama_acara.objects.get(id_nama_acara=id_nama_acara) +update.id_kategori = id_kategori +update.nama_acara = nama_acara +update.save() + +#acara +# UPDATE tbl_acara SET id_nama_acara='$id_nama_acara', waktu_acara='$waktu_acara' WHERE id_acara='$id_acara'; + +update = Tbl_acara.objects.get(id_acara=id_acara) +update.id_nama_acara = id_nama_acara +update.waktu_acara = waktu_acara +update.save() + +#jampel +# UPDATE tbl_jampel SET nama_jampel='$nama_jampel', waktu_jampel='$waktu_jampel' WHERE id_jampel='$id_jampel'; + +update = Tbl_jampel.objects.get(id_jampel=id_jampel) +update.nama_jampel = nama_jampel +update.waktu_jampel = waktu_jampel +update.save() + + + +##DELETE + +#kelas +# DELETE FROM tbl_kelas WHERE id_kelas='$id_kelas'; + +Tbl_kelas.objects.get(id_kelas=id_kelas).delete() + +#siswa +# DELETE FROM tbl_siswa WHERE id_siswa='$id_siswa'; + +Tbl_siswa.objects.get(id_siswa=id_siswa).delete() + +#akses +# DELETE FROM tbl_akses WHERE id_akses='$id_akses'; + +Tbl_akses.objects.get(id_akses=id_akses).delete() + +#guru +# DELETE FROM tbl_guru WHERE id_guru='$id_guru'; + +Tbl_guru.objects.get(id_guru=id_guru).delete() + +#kategori +# DELETE FROM tbl_kategori WHERE id_kategori='$id_kategori'; + +Tbl_kategori.objects.get(id_kategori=id_kategori).delete() + +#nama acara +# DELETE FROM tbl_nama_acara WHERE id_nama_acara='$id_nama_acara'; + +Tbl_nama_acara.objects.get(id_nama_acara=id_nama_acara).delete() + +#acara +# DELETE FROM tbl_acara WHERE id_acara='$id_acara'; + +Tbl_acara.objects.get(id_acara=id_acara).delete() + +#jampel +# DELETE FROM tbl_jampel WHERE id_jampel='$id_jampel'; + +Tbl_jampel.objects.get(id_jampel=id_jampel).delete() \ No newline at end of file diff --git a/ProjectAbsenTelkom2/Database/non_admin_queries.py b/ProjectAbsenTelkom2/Database/non_admin_queries.py new file mode 100644 index 0000000..0af465c --- /dev/null +++ b/ProjectAbsenTelkom2/Database/non_admin_queries.py @@ -0,0 +1,255 @@ +from test1.models import * +from django.utils import timezone + +# --login siswa +# SELECT id_siswa, nama_siswa, email_siswa, id_kelas FROM tbl_siswa WHERE id_siswa ='$id' AND password_siswa='$pass'; + +id_siswa = "20181" +password_siswa = "oiuqirmhjc" + +Tbl_siswa.objects.get(id_siswa__exact=id_siswa, password_siswa__exact=password_siswa) + +# siswa absen +# Ingat untuk menggunakan id_acara + +id_nama_acara = "1" +id_siswa = "20181" + +# INSERT INTO tbl_absen(id_acara, id_siswa) VALUES ((SELECT id_acara FROM tbl_acara WHERE id_nama_acara = $id_nama_acara AND waktu_acara >= DATE(NOW()) ORDER BY waktu_acara ASC LIMIT 1), '$id_siswa') +insert = Tbl_absen() +insert.id_acara = Tbl_acara.objects.filter(id_nama_acara__exact=id_acara, waktu_acara__gte=timezone.now().date())[0] +insert.id_siswa = Tbl_siswa(id_siswa=id_siswa) +insert.save() + +# INSERT INTO tbl_absensi_ami(id_jampel, id_acara, id_siswa, kehadiran, kerapihan, kebersihan) VALUES ('$id_jampel', (SELECT id_acara FROM tbl_acara WHERE id_nama_acara = '3' AND waktu_acara >= DATE(NOW()) ORDER BY waktu_acara ASC LIMIT 1), '$id_siswa', '$kehadiran', '$kerapihan', '$kebersihan'); +insert = Tbl_absen_ami() +insert.id_jampel = Tbl_jampel(id_jampel=1) +insert.id_acara = Tbl_acara.objects.filter(id_nama_acara__exact=3, waktu_acara__gte=timezone.now().date())[0] +insert.id_siswa = Tbl_siswa(id_siswa=id_siswa) +insert.kehadiran = True +insert.kerapihan = True +insert.kebersihan = True +insert.save() + +# --login guru +# SELECT id_guru, nama_guru, hak_akses FROM tbl_guru WHERE id_guru ='$id' AND password_guru='$pass'; + +id_guru = "30123" +password_guru = "24cc4cc0f3b6c3c562bf7ecab4cb70a44b8779f9114582312667f24b12f34740" + +Tbl_guru.objects.get(id_guru__exact=id_guru, password_guru__exact=password_guru) + +# --absen siwa +# SELECT * FROM tbl_absen +# INNER JOIN tbl_siswa ON tbl_siswa.id_siswa = tbl_absen.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_acara.id_nama_acara = '1' +# AND tbl_absen.waktu_absensi BETWEEN DATE(NOW()) AND DATE(DATE_ADD(NOW(), INTERVAL 1 DAY)) +# AND tbl_siswa.id_kelas = 'X1'; + +id_nama_acara = "1" +id_kelas = "X1" + +Tbl_absen.objects.select_related("id_acara", "id_siswa").filter(id_acara__id_nama_acara=id_nama_acara, waktu_absensi__range=(timezone.now().date(), timezone.now().date() + timezone.timedelta(1)), id_siswa__id_kelas=id_kelas) + +# --Hitung total poin siswa selama 7 hari yang lalu sampai hari ini +SELECT (SELECT COUNT(*) FROM tbl_absen +INNER JOIN tbl_acara ON tbl_absen.id_acara = tbl_acara.id_acara +WHERE EXISTS (SELECT * FROM tbl_validasi WHERE tbl_absen.id_absen = tbl_validasi.id_absen) +AND id_siswa="20181" AND waktu_acara between CURDATE()-7 and CURDATE()) ++ +( SELECT COUNT(*) FROM tbl_absensi_ami +INNER JOIN Tbl_acara ON tbl_absensi_ami.id_acara = tbl_acara.id_acara +WHERE kehadiran=1 AND kerapihan=1 AND kebersihan=1 +AND id_siswa="20181" AND waktu_acara between CURDATE()-7 and CURDATE()) AS Poin +; + + + +# --cek absen yang udah di validasi +# SELECT * FROM tbl_absen WHERE id_absen IN (SELECT id_absen FROM tbl_validasi); + + +# --cek absen + +# --daftar nama siswa dan kehadiran dan validasi +SELECT + tbl_siswa.nama_siswa, + tbl_kelas.nama_kelas, + IF(tbl_absen.id_absen IS NOT NULL,"HADIR","TIDAK HADIR") AS Kehadiran, + IF(tbl_absen.id_absen IS NOT NULL,IF(tbl_validasi.id_validasi IS NOT NULL,"Telah divalidasi","Belum divalidasi"), '-') AS Validasi, + IF(tbl_absen.waktu_absensi IS NOT NULL, tbl_absen.waktu_absensi, "-") AS waktu_absensi +FROM tbl_siswa +LEFT JOIN tbl_absen ON tbl_siswa.id_siswa = tbl_absen.id_siswa AND tbl_absen.id_acara = '$id_acara' +LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +INNER JOIN tbl_kelas ON tbl_siswa.id_kelas = tbl_kelas.id_kelas +WHERE tbl_siswa.id_kelas = '$id_kelas'; + +# --insert +# INSERT INTO tbl_absen(id_acara, id_siswa) VALUES ('$id_acara', '$id_siswa'); +# INSERT INTO tbl_validasi(id_absen, id_guru) VALUES ('$id_absen', '$id_guru'); + + + + + +# Laporan ( SQL Version ut MariaDB ) +SELECT main_query.id_siswa,main_query.nama_siswa + , COUNT(CASE WHEN main_query.id_nama_acara = 1 THEN id_siswa END) Ibadah_Jumat + , COUNT(CASE WHEN main_query.id_nama_acara = 2 THEN id_siswa END) Thafiz + , COUNT(CASE WHEN main_query.id_nama_acara = 4 THEN id_siswa END) Upacara + , COUNT(CASE WHEN main_query.id_nama_acara = 5 THEN id_siswa END) Pramuka + FROM (SELECT tbl_siswa.id_siswa,tbl_acara.id_nama_acara,tbl_siswa.nama_siswa FROM tbl_siswa +LEFT JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara WHERE tbl_validasi.id_validasi IS NOT NULL + ) main_query + GROUP BY main_query.id_siswa + + +# Untuk absen ami gw sediakan di tempat terpisah tapi kalo mau munculin seluruh list nama siswa untuk absen ami +SELECt nama_siswa FROm tbl_siswa WHERE id_kelas = "X1"; + + + + +# Test Only, Please Ignore. + +# # Yg ini pivot tapi untuk tabel lain +# SELECT nama_pekerja +# , SUM(CASE WHEN id_tipe = 1 THEN gaji END) Gaji_Ob +# , SUM(CASE WHEN id_tipe = 2 THEN gaji END) Gaji_Coder +# FROM (SELECT * +# FROM pekerja +# ) pekerja +# GROUP BY nama_pekerja + +# # Yg ini pivot juga untuk tabel lain ditambah wherenya +# SELECT nama_pekerja +# , COUNT(CASE WHEN id_tipe = 1 THEN gaji END) Gaji_Ob +# , COUNT(CASE WHEN id_tipe = 2 THEN gaji END) Gaji_Coder +# FROM (SELECT * +# FROM pekerja WHERE id_pekerja <10 +# ) pekerja +# GROUP BY nama_pekerja + +# # IAHSIUDGEUILrhoeathi Improve +# SELECT tbl_acara.id_nama_acara, tbl_siswa.id_siswa, COUNT(tbl_validasi.id_validasi) FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# GROUP BY tbl_acara.id_nama_acara, tbl_siswa.id_siswa + +# SELECT tbl_siswa.id_siswa, COUNT(tbl_validasi.id_validasi) FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# GROUP BY tbl_siswa.id_siswa + + +# SELECT id_siswa +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 1 THEN gaji END) Ibadah_Jumat +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 2 THEN gaji END) Thafiz +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 4 THEN gaji END) Upacara +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 5 THEN gaji END) Pramuka +# FROM (SELECT * +# FROM pekerja WHERE id_pekerja <10 +# ) pekerja +# GROUP BY nama_pekerja + + + +# SELECT tbl_siswa.id_siswa +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 1 THEN id_siswa END) Ibadah_Jumat +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 2 THEN id_siswa END) Thafiz +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 4 THEN id_siswa END) Upacara +# , COUNT(CASE WHEN tbl_acara.id_nama_acara = 5 THEN id_siswa END) Pramuka +# FROM (SELECT * FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# ) tbl_siswa +# GROUP BY tbl_siswa.id_siswa + + +# # Join +# SELECT COUNT(*) AS Acara1 FROM tbl_validasi +# INNER JOIN tbl_absen ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_absen.id_siswa = "20181" AND tbl_acara.id_nama_acara = "1" +# UNION SELECT COUNT(*) AS Acara2 FROM tbl_validasi +# INNER JOIN tbl_absen ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_absen.id_siswa = "20181" AND tbl_acara.id_nama_acara = "2" +# UNION SELECT COUNT(*) AS Acara3 FROM tbl_validasi +# INNER JOIN tbl_absen ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_absen.id_siswa = "20181" AND tbl_acara.id_nama_acara = "3" + + + +# SELECT COUNT(*) FROM tbl_validasi +# LEFT JOIN tbl_absen ON tbl_absen.id_absen = tbl_validasi.id_absen +# LEFT JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# LEFT JOIN tbl_siswa ON tbl_siswa.id_siswa = tbl_absen.id_siswa +# WHERE tbl_absen.id_siswa IN( SELECT id_siswa FROM tbl_siswa) +# GROUP BY tbl_absen.id_siswa +# ORDER BY tbl_absen.id_siswa +# ; + +# SELECT COUNT(*) FROM tbl_siswa +# INNER JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# INNER JOIN tbl_nama_acara ON tbl_nama_acara.id_nama_acara = tbl_acara.id_nama_acara +# INNER JOIN tbl_validasi ON tbl_validasi.id_absen = tbl_absen.id_absen + +# WHERE tbl_validasi.id_validasi IS NOT NULL + +# GROUP BY tbl_acara.id_acara +# ; + +# SELECT tbl_acara.id_nama_acara, COUNT(tbl_validasi.id_validasi) FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_absen.id_siswa = tbl_siswa.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# GROUP BY tbl_acara.id_nama_acara +# ; + + + + +# --belom bener ini cuman ngetest +# SELECT +# tbl_siswa.nama_siswa, +# tbl_kelas.nama_kelas, +# IF(tbl_validasi.id_validasi IS NOT NULL,"HADIR","TIDAK HADIR") AS kehadiran +# FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_siswa.id_siswa = tbl_absen.id_siswa AND tbl_absen.id_acara = '$id_acara' +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen +# INNER JOIN tbl_kelas ON tbl_siswa.id_kelas = tbl_kelas.id_kelas +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara; + +# SELECT +# tbl_siswa.id_siswa, +# tbl_siswa.nama_siswa, +# IF(tbl_validasi.id_absen IN(SELECT tbl_absen.id_absen +# FROM tbl_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_acara.id_acara = '1') +# ,"HADIR","TIDAK HADIR") AS acara1, +# IF(tbl_validasi.id_absen IN(SELECT tbl_absen.id_absen +# FROM tbl_absen +# INNER JOIN tbl_acara ON tbl_acara.id_acara = tbl_absen.id_acara +# WHERE tbl_acara.id_acara = '2') +# ,"HADIR","TIDAK HADIR") AS acara2 +# FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_siswa.id_siswa = tbl_absen.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen; + +# SELECT +# tbl_siswa.id_siswa, +# tbl_siswa.nama_siswa, +# IF( ,"HADIR","TIDAK HADIR") AS acara1 +# FROM tbl_siswa +# LEFT JOIN tbl_absen ON tbl_siswa.id_siswa = tbl_absen.id_siswa +# LEFT JOIN tbl_validasi ON tbl_absen.id_absen = tbl_validasi.id_absen; \ No newline at end of file diff --git a/ProjectAbsenTelkom2/Prototype/Pemodelan Perangkat Lunak/~$$Flowchart Projek Absensi.~vsdx b/ProjectAbsenTelkom2/Prototype/Pemodelan Perangkat Lunak/~$$Flowchart Projek Absensi.~vsdx deleted file mode 100644 index 86293570504bb9823a0d0aa583ebbf84b5bb5e23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeHKOHKko5Pg83kQjp-7sdq_;0nZq-vTmxFECLPSO|%r#^ZPdPof+5dI@(jzNbBL zATsGjHjGnbrh96t>h)CDr+I!ldVP32dBYNwk;6R5V=uzbaGnjH3&1Yt;?08~5Ie_< z)0DQz10P(g_AjOX>46?5{LN5A4P%bixK}D$(=n?+)N?k9VZE@CwUKefx3TFWv(5OM z+<*0gI4V^0)AIXEMm^=s2;bt8F*n7CQ8al*!Sik(WP7mMzU!6ZXK?