MySQL Forums
Forum List  »  Spanish

No regresa filas la consulta
Posted by: Jose Ramon Perez Villarreal
Date: May 24, 2007 03:58PM

Hola que tal tengo un problema con la siguiente consulta:

SELECT bg.id_benef,ben_nom,ben_app,ben_apm, ben_curp FROM
(
SELECT k.kar_cmatricula, k.kar_cgrupo, k.kar_dintegral, k.kar_IdEduc, k.kar_IdMateria, k.kar_fecha, 1 AS bloq, k.kar_IdNivel AS niv FROM kardex_old AS k UNION SELECT k.kar_cmatricula, k.kar_cgrupo, k.kar_dintegral, k.kar_IdEduc, k.kar_IdMateria, k.kar_fecha, 2 AS bloq, k.kar_IdNivel AS niv FROM kardex_old AS k UNION SELECT k.kar_cmatricula, k.kar_cgrupo, k.kar_dintegral, k.kar_IdEduc, k.kar_IdMateria, k.kar_fecha, 3 AS bloq, k.kar_IdNivel AS niv FROM kardex_old AS k UNION SELECT k.kar_cmatricula, k.kar_cgrupo, k.kar_dintegral, k.kar_IdEduc, k.kar_IdMateria, k.kar_fecha, 4 AS bloq, k.kar_IdNivel AS niv FROM kardex_old AS k UNION SELECT k.kar_cmatricula, k.kar_cgrupo, k.kar_dintegral, k.kar_IdEduc, k.kar_IdMateria, k.kar_fecha, k.kar_IdBloque AS bloq, k.kar_IdNivel AS niv FROM kardex AS k ORDER BY kar_cmatricula, niv, bloq, kar_IdMateria ) AS cmb LEFT JOIN benef_gral AS bg ON cmb.kar_cmatricula=bg.id_benef LEFT JOIN grupos AS g ON cmb.kar_cgrupo=g.id_grupo LEFT JOIN cebas AS c ON g.id_ceba=c.id_ceba WHERE kar_IdEduc=(select (CASE when left(ben_serv,1)='P' then 'PRI' ELSE 0 END) from benef_serv where id_benef=bg.id_benef) and concat_ws(' ', id_benef, ben_nom, ben_app, ben_apm, ben_curp) like '%$elemento%' and id_benef not like 'M%' and id_benef not in (select mat_cmigrado from temporal_migrado)
GROUP BY (kar_cmatricula) HAVING MIN(kar_dintegral)>=6 AND COUNT(cmb.kar_dintegral)=48 ORDER BY g.id_ceba

el hecho es muy curioso si ejecuto esta consulta en una base de datos con mysql 5 version libre me arroja perfectamente los datos, pero cuando la ejecuto en mysql server enterprise 5 no me arroja nada solo que le quite la clausula del GROUP BY.La verdad que no se por donde vaya el problema usamos tablas InnoDB. Les agradeceria mucho su apoyo. Ya que no se si sea cuestion del tiempo de ejecucion de la consulta o el tamano del buffer, ya que termina de los 39 a 43 segundos.

Options: ReplyQuote


Subject
Views
Written By
Posted
No regresa filas la consulta
3155
May 24, 2007 03:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.