Merge columns into a single SQL column

2

I have three columns, belonging to the same table in the database, these being: Growth, Financial Autonomy and RaciLiquidity; All columns are of type bit.

What I need is to group all three fields into one column, that is, if I do:

SELECT IsNull(Crescimento,0) As Crescimento,

IsNull(AutonomiaFinanceira,0) As AutonomiaFinanceira,

IsNull(RacioLiquidez,0) As RacioLiquidez

from Estado

I get the following:

However I want to group these three fields into a single column, for example: 000 or 0,0,0.

    
asked by anonymous 13.03.2018 / 11:37

1 answer

5

You can use CONCAT :

SELECT 
  CONCAT(
    IsNull(Crescimento,0),'-',
    IsNull(AutonomiaFinanceira,0),'-',
    IsNull(RacioLiquidez,0)
  )
from Estado;

See an example working in SQL Fiddle .

Note: The syntax of CONCAT is different between SGDBs .

    
13.03.2018 / 11:53