Skip to content
Advertisement

Truncated incorrect INTEGER value on CREATE TEMPORARY TABLE

I get this error([Err] 1292 – Truncated incorrect INTEGER value: ‘Z001’), when create temporary table vacunas2. I’m using MySql

CREATE TEMPORARY TABLE IF NOT EXISTS vacunas AS (
SELECT h.COD_ESTAB,stb.DESC_ESTAB,h.DNI,h.FECHA_NAC,h.FICHAFAM,h.ED ,DIA,MES,
  ANO,EDAD,TIP_EDAD, ESTABLEC,DX1,DX2,DX3,DX4,DX5,DX6 
FROM `hisa` h
inner JOIN establec stb
on stb.COD_ESTAB=h.COD_ESTAB
where h.ANO='2020' and ('1' or '2' in (h.MES)) AND h.ED='61');

CREATE TEMPORARY TABLE IF NOT EXISTS vacunas2 AS (
SELECT * FROM vacunas
where 'Z001' OR 'Z006' or '99403' or 'U140' OR '99401 'IN (DX1,DX2,DX3,DX4,DX5,DX6)
order by DNI,FECHA_NAC ASC);


SELECT * FROM vacunas2;

Advertisement

Answer

This does not make sense:

where 'Z001' OR 'Z006' or '99403' or 'U140' OR '99401 'IN (DX1,DX2,DX3,DX4,DX5,DX6)

Perhaps you intend:

WHERE 'Z001' IN (DX1, DX2, DX3, DX4, DX5, DX6) OR
      'Z006' IN (DX1, DX2, DX3, DX4, DX5, DX6) OR
      '99403' IN (DX1, DX2, DX3, DX4, DX5, DX6) OR
      'U140' IN (DX1, DX2, DX3, DX4, DX5, DX6) OR
      '99401' IN (DX1, DX2, DX3, DX4, DX5, DX6)
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement