
December 4th, 2003, 12:44 AM
|
|
Junior Member
|
|
Join Date: Dec 2003
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Order by not working properly
Here is my problem,
I have a table with sessions, and a table with events. Each event has multiple sessions. I want to list the events in order of when their earliest session is on.
The query does this, but it does not do the ordering of the date properly in the main query. e.g.
12/7/2003
12/5/2003
2/4/2004
SELECT tblEvent.intID, tblEvent.strTitle, tblEvent.strURL, (SELECT tblSession.dtmSessionDate FROM tblSession WHERE tblSession.intEvent=tblEvent.intID ORDER BY dtmSessionDate) AS Expr1
FROM tblWorkflow INNER JOIN tblEvent ON tblWorkflow.intEvent = tblEvent.intID
WHERE (((tblEvent.dtmDisplayFrom)<=Date()) AND ((tblEvent.dtmDisplayTo)>=Date()) AND ((tblEvent.dtmDisplayURLFrom)<=Date()) AND ((tblEvent.dtmDisplayURLTo)>=Date()) AND ((tblWorkflow.intStep)=5))
ORDER BY 4;
This is most annoying, any help would be appreciated either in the form of a query that works for this problem, or fixing this one.
|