I wanna join two table in laravel , reads one record from first table and multiple record from second table. The first table has some field that I want to select all. The second table has been connected to first table with foreign key. Show multiple records using comma.
First Table:
-----------
+----+-------------+
| id | some_fields |
+----+-------------+
| 23 | S.V |
+----+-------------+
| 24 | S.T |
+----+-------------+
| 25 | S.M |
+----+-------------+
Second Table:
------------
+----+----------+------------+
| fid| meta_key | meta_value |
+----+----------+------------+
| 24 | meta_1 | m_1 |
+----+----------+------------+
| 24 | meta_2 | m_2 |
+----+----------+------------+
| 25 | meta_2 | m_3 |
+----+----------+------------+
Output that I want:
+----+-------------+----------------+
| id | some_fields | meta_value |
+----+-------------+----------------+
| 24 | S.T | m_1 , m_2 |
+----+-------------+----------------+
| 25 | S.M | m_3 |
+----+-------------+----------------+
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire