Concatenate two sql

Asked

Viewed 95 times

5

I have the records:

|DT_OBS  | DESC_OBS | COD_TURNO | COD_PERIODO|
|01.10.16|  TESTE 01|     1     |   1        |
|01.10.16|  TESTE 02|     2     |   1        |
|01.10.16|  TESTE 03|     1     |   2        |
|02.10.16|  TESTE 04|     1     |   1        |
|02.10.16|  TESTE 05|     1     |   2        |

I want you to call me back:

|DT_OBS  | DESC_OBS |
|01.10.16|  TESTE 01TESTE 02TESTE 03
|02.10.16|  TESTE 04TESTE 05

How do I join DESC_OBS?

1 answer

8


Since version 2.1, the function LIST() do what you want:

SELECT
  DT_OBS,
  LIST(DESC_OBS) AS LISTA_OBS
FROM
  registros
GROUP BY
  DT_OBS

The LIST() Firebird is similar to GROUP_CONCAT() Mysql, however, without the option to sort the results.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.