R
R
rinaz222022-04-08 11:21:15
MySQL
rinaz22, 2022-04-08 11:21:15

How to exclude certain values ​​with GROUP_CONCAT mysql?

Hello. I make a request to the database and in response I get a very large amount of data in the group (GROUP BY).
One of the columns I get is with GROUP_CONCAT.
Question: How to exclude unnecessary data from GROUP_CONCAT?
For example GROUP_CONCAT(`status`) status can contain 0, 1, 2, 3. How to remove 0 so that only 1, 2, 3 remain?
Or maybe there is some other function for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2022-04-08
@rinaz22

group_concat(case when status <> 0 then status end)

https://www.db-fiddle.com/f/djHBDhjYCtT7q1mtFaqF1N/0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question