hola mi consulta funciona perfectamente cuando una variable o campo de la consulta la iguala a un valor numerico, pero ahora quiero que se iguale a una cadena que contiene varios valores numericos .
TblComInt.CveEntCom=4535
cadena="4535,4536,4537,4538,4539,4540";
hora quiero k se iguale a una varible definida como cadena anteriormente: TblComInt.CveEntCom=4535
Código MySQL:
Ver originalselect TblIntegrantes.clave
, TblIntegrantes.ApsEntInt
,TblIntegrantes.NomEntInt
, Portafolios.portEntregados
, Portafolios.portCal
from (select TblComInt.CveEntCom
,TblEntInt.CveEntInt
as clave
, ApsEntInt
, NomEntInt
from TblComInt
, TblEntInt
where TblComInt.CveEntCom
=4535 and TblComInt.CveEntInt
=TblEntInt.CveEntInt
and TblComInt.CveEntPrf
=3 order by ApsEntInt
, NomEntInt
) as TblIntegrantes
LEFT JOIN (select TblEntPrt.CveEntInt
as clave2
, count(TblEntPrt.CveEntPrt
) as portEntregados
, count(TblCalPrt.CalEntPrt
) as portCal
, TblEntPrt.CveIntRev
, TblEntAct.CveEntAct
from TblEntAct
, TblAsgAct
, TblEntPrt
left join TblCalPrt
on TblEntPrt.CveEntPrt
=TblCalPrt.CveEntPrt
where TblEntPrt.CveEntCom
=4535 and TblEntAct.CveEntAct
=TblEntPrt.CveEntAct
and TblAsgAct.CveEntCom
=4535 and TblEntAct.CveEntAct
=TblAsgAct.CveEntAct
and TblEntPrt.CveIntRev
=0 group by clave2
) as Portafolios
on TblIntegrantes.clave
=Portafolios.clave2
order by TblIntegrantes.CveEntCom
;
select TblIntegrantes.clave, TblIntegrantes.ApsEntInt,TblIntegrantes.NomEntInt, Portafolios.portEntregados, Portafolios.portCal from (select TblComInt.CveEntCom,TblEntInt.CveEntInt as clave, ApsEntInt, NomEntInt from TblComInt, TblEntInt where TblComInt.CveEntCom=4535 and TblComInt.CveEntInt=TblEntInt.CveEntInt and TblComInt.CveEntPrf=3 order by ApsEntInt, NomEntInt) as TblIntegrantes LEFT JOIN (select TblEntPrt.CveEntInt as clave2, count(TblEntPrt.CveEntPrt) as portEntregados, count(TblCalPrt.CalEntPrt) as portCal, TblEntPrt.CveIntRev, TblEntAct.CveEntAct from TblEntAct, TblAsgAct, TblEntPrt left join TblCalPrt on TblEntPrt.CveEntPrt=TblCalPrt.CveEntPrt where TblEntPrt.CveEntCom=4535 and TblEntAct.CveEntAct=TblEntPrt.CveEntAct and TblAsgAct.CveEntCom=4535 and TblEntAct.CveEntAct=TblAsgAct.CveEntAct and TblEntPrt.CveIntRev=0 group by clave2) as Portafolios on TblIntegrantes.clave=Portafolios.clave2 order by TblIntegrantes.CveEntCom;