first of all, DISTINCT is not a function, so let's get rid of that
secondly, it is recommended to qualify every column with its table name
that way you will be able to read the query and figure out which table each column comes from, which i cannot do right now
your problem was due to omitting the LEFT keyword in LEFT OUTER
LEFT is mandatory, it's actually OUTER that's optional
;o)
Code:
SELECT er_id
, event_name
, team_company
, title
, name
, lastname
, event_type
, event_deadline
, sdate
, assigned_fk
, team_leader
, STRCMP(assigned_fk,0) AS sort
, CURDATE()
FROM events
INNER
JOIN event_reg
ON event_reg.event_fk = events.event_id
LEFT OUTER
JOIN hotel_reg
ON hotel_reg.er_fk = event_reg.er_id
WHERE event_deadline >= CURDATE()
AND reg_status='New'
AND assigned_fk IS NULL
ORDER
BY sort
, team_leader DESC
, sdate
, event_name
, team_company
Bookmarks