Structures of my tables are as follow.

Table Name : timetable


Table Name : slot_table


Table Name : instructor(this table is not required for this particular problem)

I want to show the resultant data in my android app in a timetable format somewhat like this:


Question : What query i should write so that subjects of particular days with respective slots will be the result of the query?

1)The days should be in order like monday,tuesday,wednesday.

2)If monday has 2 subjects in 2 different slots then it should display like this :

Day         7:30-9:10AM           9:20-11:00AM        

Monday      Android Workshop      Operating System

This is just a sample.

P.S:As timetable format is required,all the subjects with slot ids of all the days(monday to saturday) must be there in it.

Edit :

I tried this

select day,subject,slot from timetable,slot_table where timetable.slotid = slot_table.slotid 

which gave a result :

a result

But i want it in a timetable format which i am not having an idea how to do that.

Edit :

Timetable sample format is something like this :


An SQL dump of your table structures with some data would be more useful than images.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.