0

I have a table

info

idno  studno  name  
1509  001     Mark
1510  002     Dennis
1690  003     Ben
1671  004     Martial
1257  005     Lucy

attendance

idno  Date  
1509  2017/12/1
1510  2017/12/1
1671  2017/12/1
1257  2017/12/1
1509  2017/12/2
1510  2017/12/2
1671  2017/12/2
1257  2017/12/2
1690  2017/12/2

What I want to display is

name    2017/12/1  2017/12/2
Mark        P         P
Dennis      P         P
Ben         A         P
Martial     P         P
Lucy        P         P

Can somebody help me, and also I have seen some codes(prepared statement) but it seems no to work in phpmyadmin routines

O. Jones
  • 103,626
  • 17
  • 118
  • 172
Lughen
  • 45
  • 5
  • What have you tried if anything? You must show some effort in solving it – Pikoh Apr 19 '17 at 11:29
  • What you seek is called *pivoting*. It's a notorious pain in the neck in MySQL. – O. Jones Apr 19 '17 at 11:31
  • Yes, you're right Jones.I'm having a hard time using those codes I have seen, since I don't I understand how it works. Specially, dynamic sql. – Lughen Apr 19 '17 at 11:37
  • have a look at this answer http://stackoverflow.com/questions/7674786/mysql-pivot-table it might point you in the right direction – Takarii Apr 19 '17 at 11:45
  • Just use a bit of application code to format the data. I'd show you how but I don't know vb – Strawberry Apr 19 '17 at 12:20

0 Answers0