user3440030
user3440030

Reputation: 45

MySQL : combine multiple row into one row

I have a mysql table with this :

enter image description here

In table 1, i have 3 column : Bidang, Keahlian, Nilai. In table result in the coloumn saran i want to combine keahlian based on bidang, but keahlian taken if nilai > 0. The result like this :

enter image description here

So, please help me to make this.

Upvotes: 0

Views: 105

Answers (3)

Nikul
Nikul

Reputation: 1025

You can user bewlow query

SELECT bidang,GROUP_CONCAT(kealian) as saran
FROM table1 
WHERE nilai>=0
GROUP BY bidang

Upvotes: 0

jmail
jmail

Reputation: 6134

like this:

SELECT Bidang,GROUP_CONCAT(Keahlian SEPARATOR ',') As Saran
FROM Table_1
WHERE Nilai>0
GROUP BY Bidang 

Upvotes: 1

Sadikhasan
Sadikhasan

Reputation: 18600

Try this

SELECT Bidang,GROUP_CONCAT(Keahlian SEPARATOR ',') 
FROM table_1 
WHERE Nilai>0
GROUP BY Bidang 

Upvotes: 1

Related Questions