Que tal,
estoy tratando de crear una LLAVE PRIMARIA usando la combinación de 2 columnas de una tabla usando la siguiente consulta:
ALTER TABLE proturs_test.contr_hoteles_inventario
ADD PRIMARY KEY(CONCAT(LPAD(id,6,'0'),LPAD(DATEDIFF(fecha,'1980-01-01'),5,'0'))) NOT NULL
;
Pero al ejecutarla, me marca que existe un error.
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LPAD(id_hotel,6,'0'),LPAD(DATEDIFF(fecha,'1980-01-01'),5,'' at line 2
Thanks in advance for your valuable help.
Acer LENOVO G450
CPU: Pentium(R) Dual-Core CPU T4400 @ 2.20GHz × 2
RAM: 4GB
Graphics: Intel GM45
OS: UBUNTU 18.04.4 LTS 64bits
GNOME 3.28.2
--
Best regards
Marco
Mexico City, Mexico