查询无法处理左连接?

I have following query which gives me result with single marstat.

SELECT
  a_event . *,
  members.*  
FROM a_event
  INNER JOIN members
    ON (members.mem_id = a_event.a_uid)
  LEFT JOIN `profiles`
    ON (profiles.mem_id = members.mem_id
        AND profiles.marstat =  'Single')
WHERE a_event.a_event_id = '5496'
    AND members.gender = 'm'
    AND a_event.a_fb_event_id = '0'

But the actual situation is that a_event member must match with member table (INNER JOIN is compulsory) then this result will match with profiles table 's mem_id having marital status as single . But the main problem is profile table may contain result with profiles.mem_id or no entry so that user from a_event.mem_id if not present in profiles.mem_id then that user will also be considered as single

Please help thanks

If I understand your question correctly you want a row to be returned when:

a) the user has a profile and is single b) the user has no profile

In that case the query should be:

SELECT
  a_event . *,
  members.*  
FROM a_event
  INNER JOIN members
    ON (members.mem_id = a_event.a_uid)
  LEFT JOIN `profiles`
    ON (profiles.mem_id = members.mem_id)
WHERE a_event.a_event_id = '5496'
    AND members.gender = 'm'
    AND a_event.a_fb_event_id = '0'
    AND (profiles.marstat =  'Single' OR profiles.marstat IS NULL)

without a fiddle it's hard to test, but try this: updated answer with fiddle

    SELECT
      a_event . *,
      members.*  
    FROM a_event
      INNER JOIN members
        ON (members.mem_id = a_event.a_uid)
      LEFT JOIN `profiles`
        ON (profiles.mem_id = members.mem_id)
    WHERE a_event.a_event_id = '5496'
        AND members.gender = 'm'
        AND a_event.a_fb_event_id = '0'
        AND (profiles.marstat =  'Single' or is null)

http://sqlfiddle.com/#!2/99b774/3