[trick] 2 Relasi atau 3 Relasi ?

Bismillah…

Ini pengalaman gw pas mau buat modul kuisioner…

SELECT b.tanya, GROUP_CONCAT(a.jawab) as pilihan
FROM jawaban a 
INNER JOIN pertanyaan b ON a.id_pertanyaan = b.id
GROUP BY b.id

SELECT a.*, b.SOAL, GROUP_CONCAT(c.KET) as jawaban
FROM kuis_jawaban_soal a
INNER JOIN kuis_master_soal b ON b.ID_SOAL=a.ID_SOAL
INNER JOIN kuis_master_jawaban c ON c.ID_JAWABAN=a.ID_JAWABAN
GROUP BY a.ID_SOAL;

KELUARANNYA SAMA… DENGAN STRUKUTUR BEDA? YANG SALAH ANALISA AWAL ATAU PROGRAMMER YANG BODOH? MUNGKIN 2.2 NYA ADA DI GW… HAHAHA

HAVE A NICE DAY

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: