Mapping Same Database Field to Two Different Columns in Custom Model Metadata

The base of my model is sql. The first table has two fields, one is start_staff_id, the other is end_staff_id. Both of the columns connect to the staff table in the database so I must do two table joins in order to get the staff members name, not just their staff id in the final table). First I join to the staff table via start_staff_id = staff_id, then do a second join end_staff_id = staff_id.

I save it as a model and set the metadata, mapping the start_staff_name and end_staff_name columns to the staff field (I can access the staff member's name via the joins that I did on the staff table).

When I go to the query builder, both columns (start_staff_name and end_staff_name) are the end_staff_name column, including having the same name and having the same data. Is it because I mapped two different model columns to the same table/field in the database? I have tried a workaround in which I first created a model in sql without joining to the staff table, but including only the start_staff_id and end_staff_id columns, then do table joins in the query builder, but come to the same result.

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.16+8",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.16",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.16+8",
"os.name": "Linux",
"os.version": "4.15.0-172-generic",
"user.language": "en",
"user.timezone": "Asia/Shanghai"
},
"metabase-info": {
"databases": [
"h2",
"mysql"
],
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "5.7.26-log"
},
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.7.5"
}
},
"run-mode": "prod",
"version": {
"date": "2022-08-04",
"tag": "v0.44.0",
"branch": "release-x.44.x",
"hash": "d3700f5"
},
"settings": {
"report-timezone": null
}
}
}

Hi @mere_data_analyst
You're seeing this issue:
https://github.com/metabase/metabase/issues/23019 - upvote by clicking :+1: on the first post