Hello,
I have this query that i want to concat the values in between the "()". How can i do it correctly?
Sql query:
string SQL = "SELECT a.id_veiculo, a.id_empresa, a.nome_condutor, a.empresa_visitante, a.empresa_visitar, a.visitado, a.ncartao, (a.data + a.hora) as 'Entrada', a.obs,a.sector, (b.data + b.hora) as 'Saida' FROM entradas a LEFT OUTER JOIN saidas b ON a.data = b.data AND a.hora = b.hora and a.sector WHERE id_empresa = @tabempresa; ";
EDIT:
string SQL = "SELECT a.id_veiculo, a.id_empresa, a.ncartao, a.nome_condutor, a.empresa_visitante, a.empresa_visitar, a.visitado, CONCAT(a.data,a.hora) as 'Entrada',a.sector,a.obs, CONCAT(b.data,b.hora) as 'Saida' FROM entradas a LEFT OUTER JOIN saidas b ON a.data = b.data AND a.hora = b.hora and a.sector WHERE id_empresa = @tabempresa; ";
This string works fine, but i have the value in it like "2016-03-0109:58:00" and i want it to be like so "2016-03-01 / 09:58:00"
What I have tried:
Tryied to replicate this string with the CONCAT where i wanted to combine data, like so:
string SQL = "SELECT a.id_veiculo, a.id_empresa, a.nome_condutor, a.empresa_visitante, a.empresa_visitar, a.visitado, a.ncartao, CONCAT(a.data, a.hora) as 'Entrada', a.obs,a.sector, (b.data, b.hora) as 'Saida' FROM entradas a LEFT OUTER JOIN saidas b ON a.data = b.data AND a.hora = b.hora and a.sector WHERE id_empresa = @tabempresa;