0

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.

1
  • 1
    GROUP_CONCAT and GROUP BY Commented Mar 31, 2014 at 9:18

3 Answers 3

1

Try this

SELECT Bidang,GROUP_CONCAT(Keahlian SEPARATOR ',') 
FROM table_1 
WHERE Nilai>0
GROUP BY Bidang 
Sign up to request clarification or add additional context in comments.

5 Comments

If i want to input a Group_Concat in conditional statement. how to i make it?
what you mean by add this function?
your code doesn't work, you are doing the mistake in your query not a SEPARATER you should use this SEPARATOR
Also you forgot "as Saran" to make it look like the question author wanted.
@jmail sorry spelling mistake
1

like this:

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

1 Comment

If i want to input a Group_Concat in conditional statement. how to i make it?
0

You can user bewlow query

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.