MySQL query to get value information from another table based on id with 3 different attribute
NickName:HiDayurie Dave Ask DateTime:2021-01-21T09:36:45

MySQL query to get value information from another table based on id with 3 different attribute

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

More about “MySQL query to get value information from another table based on id with 3 different attribute” related questions

MySQL query to get value information from another table based on id with 3 different attribute

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

Show Detail

How to transform a MySQL table into another that has key value pairs?

I have to accomplish a requirement in MySQL, where I need to convert a regular table into another one with key value pairs, for which I am unable to find any answers (I'm relatively new to SQL). I...

Show Detail

Reading from one table to get a field and then using that field info to query and get information from another field takes a LONG time

I am writing a desktop application that connects to a MySQl database on a remote server. I have two tables in a MySQL database. One Table called Client contains the Contacts Id and other basic con...

Show Detail

PHP get MYSQL id from on table and foreach inside another table

So I have two tables in my MYSQL database, and the first table I need to get the id for the user and then get the information on this user from the second table. I need to get 10 random id's from ...

Show Detail

Link another table based on a column value

Hi, I'm designing a item catalog using MySQL and Squalize ORM (NodeJS). Suppose I have a product list with different attributes based on its category (attributes_id in this case). I would like to ...

Show Detail

Query MYSQL database using PDO based on the first value of another table

Hi I am having trouble querying a mysql table based on the first value of another table here is my code. <?php $host = 'localhost'; $db = 'msdds'; $user = 'root'; $pass = &#x

Show Detail

Mysql get records having multiple values on a different (relational) table (manyToMany)

I need some help getting records based on a criteria where joining items table with their values table, having multiple search values. Items table +----+-----------+ | id | title | +----+----...

Show Detail

Update one MySQL table with values from another

I'm trying to update one MySQL table based on information from another. My original table looks like: id | value ------------ 1 | hello 2 | fortune 3 | my 4 | old 5 | friend And the tobeupdated

Show Detail

Update one MySQL table with values from another

I'm trying to update one MySQL table based on information from another. My original table looks like: id | value ------------ 1 | hello 2 | fortune 3 | my 4 | old 5 | friend And the tobeupdated

Show Detail

Select COLUMN name from one table based on VALUE from another in mySQL?

If I have JOBS with these values, let's say: id|rate_type|hours|is_hourly 1|rate_a|2|1 2|rate_b|1|1 3|rate_a|3|1 4|rate_c|1|0 and another table JOBS_PREFS that has something like this: id|rate_a|

Show Detail