I am not sure if I will explain this correctly but here goes.
Our website has a functionality that will allow certain users to schedule classes. We also have a feature that allows users to add people to these classes. On this particular page we have a query that gets all classes that have a start date >= todays date.
We are looking to show all classes that have a start date >= todays date plus the last 5 classes that occured before todays date. Is there anyway this can be done through a query or am I going to have to:
get all classes in the database for this particular course
put into an array
loop through array until today's date is found
go back the array index - 5
to get the last 5 classes?
Below is the query that I am using:
Thanks for the help
Our website has a functionality that will allow certain users to schedule classes. We also have a feature that allows users to add people to these classes. On this particular page we have a query that gets all classes that have a start date >= todays date.
We are looking to show all classes that have a start date >= todays date plus the last 5 classes that occured before todays date. Is there anyway this can be done through a query or am I going to have to:
get all classes in the database for this particular course
put into an array
loop through array until today's date is found
go back the array index - 5
to get the last 5 classes?
Below is the query that I am using:
Code:
select l.class_id, l.class_date, l.class_size, to_char(l.start_time, 'hh12:mi AM') start_time,
to_char(l.end_time, 'hh12:mi AM') end_time
from classes l, courses c
where c.site_id = 1
and l.course_id=c.course_id
and l.course_id = 3736
and l.start_time >= to_date('5/3/2006', 'mm/dd/yyyy')
order by l.class_date
Thanks for the help