Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make table out of output

Status
Not open for further replies.

jlynch1

Technical User
Dec 20, 2001
100
IE
This is the query I am using to retrieve the data I want to put into a timetable.

SELECT * FROM timetable
WHERE progCode=1OK
AND sem =1
ORDER BY time,day

time day courseCode location type
9 1 IE876 3 B Industrial 2
9 2 HP851 Room AC 133 1
9 3 IE875 3 B Industrial 1
9 5 IE877 Dillon Theatre 1
10 1 IE876 3 B Industrial 2
10 2 EP853 Room AC 133 1
10 3 IE875 3 B Industrial 1
10 4 IE877 Bromwich Suite 3
11 4 IE877 Bromwich Suite 3
14 1 EP853 Physics Lab 2
14 2 IE876 3 B Industrial 1
14 3 IE876 3 B Industrial 1
14 4 IE877 3
14 5 LW851 Block S 1

The timetable will have days across the top and hours down the side.

I have the data sorted on time and then on day. The number represents the day of the week.

I will have a row with cells for classes taking place at 9.
A row with cells for classes taking place at 10 etc like an ordinary timetable.

my question is
Would I be better off selecting the data for all the classes on at 9 and making that row. Then selecting all classes on at 10 and so on like the following

SELECT * FROM timetable
WHERE progCode=1OK
AND sem = 9
AND time = 9
ORDER BY time,day

There would be 7 selects.

would this approach be more expensive in terms of time than the approach using the first sql statement given that the first one would require more loops , if statements etc


 
Hi JLynch,

Gotta be honest with you - I think that you are either responsible for a country's timetable, or you are deeply interested in 'timetable management' or you're running the software on a ZX Spectrum.
(Only the above will mean that your query order will make a difference).

The way that you query the data has little affect compared with how you have designed the tables.

If your design is relational, I can't see a problem.

Regards,

Darrylle










"Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top