I'm trying to query data with MySQL database.
I have 2 tables.
tbl_alarm
id | alarm | file
1 | Alarm1| Alarm1.mp3
2 | Alarm2| Alarm2.mp3
3 | Alarm3| Alarm3.mp3
4 | Alarm4| Alarm4.mp3
tbl_profile
alarmFront | alarmLeft | alarmRight
1 | 3 | 2
Now I need to get alarm file based on id in tbl_profile. So the view will be like this.
alarmFront | alarmLeft | alarmRight
Alarm1.mp3 | Alarm3.mp3| Alarm2.mp3
SQL Fiddle
How can I do it on sql query code?
Copyright Notice:Content Author:「HiDayurie Dave」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65820014/mysql-query-to-get-value-information-from-another-table-based-on-id-with-3-diffe