sql >> Base de Datos >  >> RDS >> Mysql

mySQL unirse a la misma tabla dos veces

Puedes hacer algo así:

select 
 audit_log_entries.created_at,
 audit1.name as originator,
 audit2.name as terminator
from audit_log_entries 
 join audit_log_orig_term_types audit1 on audit_log_entries.originator_type_id = audit1.id
 join audit_log_orig_term_types audit2 on audit_log_entries.terminator_type_id = audit2.id;