I have the following problem, I need to concatenate two dates and format them, the two fields of dates that I want to concatenate, I just want to show a date, since the other one is regularly empty. Some products do not have a date, so it is placed "N / A". The query is as follows:
SELECT DISTINCT
A.codigo_producto, B.nombreproducto, date_format(A.fechakardex, '%d/%m/%Y') as fechak,
CONCAT_ws('',A.requientrada,'',A.requisalida) As referencia,
CONCAT_WS('',G.nombreservicio,'',J.nombre) As remitente,
ifnull(A.cantentrada, '0.00') as cantidade, ifnull(A.precio_entrada, '0.00') as precioE,
ifnull(TRUNCATE((A.cantentrada * A.precio_entrada),2), '0.00') AS totalentrada,
CONCAT_WS(A.fechavenci,'',A.fecha_salida) as fechav,
CONCAT_WS('',A.nolote,'',A.lote_salida)as Lote,ifnull(A.cantsalida, '0.00') as cantidads,
ifnull(A.saldo_stock, '0.00') as saldostock,
CONCAT_WS('',ifnull(A.precio_entrada, '0.00'),'',ifnull(A.precio_salida,'0.00')) as precioU,
CONCAT_WS('',F.Obersvaciones,'',h.Obersvaciones) as observaciones
FROM tbl_kardex A
LEFT JOIN tbl_productos B ON A.codigo_producto=B.codigobarras
LEFT JOIN tbl_salidas F ON A.requisalida=F.requisalida
LEFT JOIN tbl_servicios G ON F.tbl_servicios_codigoservicio= G.codigoservicio
LEFT JOIN tbl_entradas H ON A.requientrada = H.requientrada
LEFT JOIN tbl_proveedores J ON H.tbl_proveedores_codigo_proveedor=J.codigo_proveedor
WHERE A.codigo_producto='19072017A005266006'
and A.fechakardex>='2017-10-17' and A.fechakardex<='2018-10-23'
The question here is that it gives me back the date, in the following way:
2022-12-310000-00-00
I would like you to return me in the following way:
12-31-2022
and I want you to skip the date
00-00-0000
in advance thanks, I do not know much about mysql ...
Thanks for your help