SQL join two tables with specific condition
问题 Table A structure: Table B structure: Above are two tables, TableB.TableARelationID is a relationID which used to map table A. Desired output: The desired result would be taking TableA.RecordID and TableB.Text, but only of Type 2 in table B, i.e. ignore Type 1 Below is the SQL query which I used: SELECT tablea.recordid, tableb.text FROM tablea LEFT JOIN tableb ON tablea.relationid = tableb.tablearelationid WHERE type = 2 But the above query would output: i.e. RecordID 1 was missing, as the