Mysql
 sql >> Database >  >> RDS >> Mysql

mySQL si unisce alla stessa tabella due volte

Puoi fare così:

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;