MEETINGS, MeetingID, Description, RoomID, Date, ROOMS, RoomID, Name, Size $sql = " select *, to_days(MEETINGS.Date) = to_days({$match_date}) as meeting_today from ROOMS left outer join MEETINGS on ROOMS.RoomID = MEETINGS.ROOMID order by (to_days(MEETINGS.Date) = to_days({$match_date})), other_order_clauses... ";