Home > database >  how to join two query into one column
how to join two query into one column

Time:01-24

select  
    Name,
    convert(varchar, Connect, 103) Connect,
    convert(varchar, Connect, 108) Connect,
    Job
from 
    TableWork
where 
    Account ='Account1'

Result :

Mary | 23/01/2022 | 18:39:00 | Manager

I need to join the two columns of times so they look like this:

Mary | 23/01/2022 18:39:00 | Manager

Thanks a lot for the help

CodePudding user response:

I think you are looking for something like this

SELECT
  Name,
  convert(varchar, Connect, 103) Connect || ' ' || convert(varchar, Connect, 108) Connect AS Date,
  Job
FROM
  TableWork
Account ='Account1'

The || is an operator for string concatenation and whatever you put inside the quotation marks will be concatenated, in this case a white space.

The AS is to indicate a temporal name for the new column, the one formed with the concatenated strings, in this case "Date".

  •  Tags:  
  • Related