A
A
Alexander Lozovoy2015-03-24 14:30:31
SQL
Alexander Lozovoy, 2015-03-24 14:30:31

How to build a SQL query to get the status of work stages in one line?

There is a table with three columns, the following form:
35260aac9b66402cb0b687c517320b9d.GIF
The productid field contains the serial number of the product, the stage field contains the current stage of work, the last field contains the status of the stage of work.
I need to get the following string in the output: 56300 + + - - -
or at least like this: 56300 ready ready in the process is planned null
How to build a SQL query to get such a result?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
whats, 2015-03-24
@aerounit

SELECT productid, group_concat(IFNULL(status, 'NULL') SEPARATOR '---') FROM table group by productid;

A
Artyom Karetnikov, 2015-03-24
@art_karetnikov

It is possible to do so. But you can't do that.
State your task, not how you did it.
An analogy to your question:
I want to break my leg and then walk like this, how to do it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question