I am currently at project of creating scheduling system based on web. I want to get data from database, and display it in table (schedule format).
In database, I have 2 table
schedule id date day 1 22/09/2014 Monday 2 23/09/2014 Tuesday
block block_id schedule_id worker shift 1 1 Ahmad 1 2 1 Abdul 1 3 1 Faris 2 4 2 Iqbal 2
Each day of schedule has several block and schedule_id (in block) is refer to which day it should be. Coloumn shift (in block) is defining block as morning (shift=1) and evening (shift=2),
I want to display something like this
date day Morning Evening 22/09/2014 Monday Ahmad Faris Abdul 23/09/2014 Tuesday Iqbal
I have tried to create sql statement like
SELECT schedule.date, schedule.day, block.worker FROM schedule LEFT JOIN block ON schedule.id = block.schedule_id
but the table isn't in appropiate format
date day Morning Evening 22/09/2014 Monday Ahmad 22/09/2014 Monday Abdul 22/09/2014 Monday Faris 23/09/2014 Tuesday Iqbal
I know something missing in my statement, and how i to accomplish this.
Thanks for your help.
) – iqbalplague Jun 03 '14 at 05:48