Moehre
Moehre

Reputation: 151

How to combine the value of two columns in PostgreSQL?

inside my CASE statement I will select the values of two columns (b.start_time and c.end_time). I tried it this way but it doesn´t work.

for example:

SELECT
     CASE WHEN a.id = 4 THEN (SELECT (b.start_time , c.end_time) 
                              FROM table b, table c WHERE ...)
     END as time    
INTO table test


FROM ...

WHERE ... `

start_time: 1000 end_time: 1100

Result:

time: 10.00,11.00

I can select one value either start or end time. But how can I select both value and put it into one column? Is this possible?

Upvotes: 0

Views: 3232

Answers (1)

Ryan
Ryan

Reputation: 541

Yes it is possible.

Just use SELECT CONCAT(b.start_time, c.end_time) FROM ...

Heres a link to the MySQl documentation: here

Upvotes: 2

Related Questions