SELECT AlertTypeID FROM incidentalert
INNER JOIN incidentalerttype
ON incidentalert.alerttypeid=incidentalerttype.AlertTypeID
WHERE IncidentID=111210
Run Code Online (Sandbox Code Playgroud)
AlertTypeID是表1中的列,表2中是主键.我如何消除歧义?
试试这个:
SELECT
ia.AlertTypeID
FROM
incidentalert ia
inner join incidentalerttype iat on iat.alerttypeid=ia.AlertTypeID
where
ia.IncidentID=111210
Run Code Online (Sandbox Code Playgroud)