Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LovelyBoy's avatar

Join Two Tables

Guys i am facing difficulity to joining two tables. 1st table Name dieases having fields

id
name
description

2nd table is combinations having fields

id
title
dieases_id

Now i want to join these 2 tables but my problem is at dieases_id field ids are stored with comma seprated Like

Row 1
id = 1 title = Something And dieases_id = 1,2
Row 2
id = 1 title = Something And dieases_id = 1,2,3
Row 3
id = 1 title = Something And dieases_id = 1,2,4

How can i join them in laravel i want to show combinations with dieases name ? Help needed

0 likes
3 replies
LovelyBoy's avatar

I Make a query and its working fine can any one tell me how can i convert this query to laravel 5

SELECT  a.id,GROUP_CONCAT(b.name ORDER BY b.id) DieasesName FROM combinations a INNER JOIN diseases b ON FIND_IN_SET(b.id, a.dieases_id) > 0 GROUP  BY a.id

How can i ?

LovelyBoy's avatar

@bobbybouwmann can you help me to make this query in laravel

SELECT  a.id,GROUP_CONCAT(b.name ORDER BY b.id) DieasesName FROM combinations a INNER JOIN diseases b ON FIND_IN_SET(b.id, a.dieases_id) > 0 GROUP  BY a.id
1 like

Please or to participate in this conversation.