Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to alias Inner join column in MySQL

SELECT AlertTypeID FROM incidentalert 
INNER JOIN incidentalerttype 
ON incidentalert.alerttypeid=incidentalerttype.AlertTypeID
WHERE IncidentID=111210

AlertTypeID is a column in table 1, and a primary key in table 2. How can I disambiguate?

like image 560
patrick Avatar asked Dec 28 '22 15:12

patrick


1 Answers

Try this:

SELECT 
    ia.AlertTypeID 
FROM
    incidentalert ia 
    inner join incidentalerttype iat on iat.alerttypeid=ia.AlertTypeID
where 
    ia.IncidentID=111210
like image 113
everton Avatar answered Dec 30 '22 06:12

everton