Created
October 7, 2013 21:12
-
-
Save enlacee/6875051 to your computer and use it in GitHub Desktop.
sub consulta mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
maa.idmarca, | |
maa.nombremarca, | |
(SELECT COUNT(*) FROM npc_detallebusqueda db | |
INNER JOIN npc_versionAutoEnte vae ON db.idauto = vae.idauto | |
INNER JOIN npc_version ve ON vae.idversion = ve.idversion | |
INNER JOIN npc_marca AS ma ON db.IdMarcaDetalleBusqueda = ma.idmarca | |
INNER JOIN npc_tipoauto AS t ON t.idtipoauto = db.IdTipoAutoDetalleBusqueda | |
WHERE (t.idTipoVehiculo = 1) | |
AND (ve.flagActivo = 1) | |
AND (vae.flagActivo = 1) | |
AND ma.idmarca = maa.idmarca | |
) AS conteo | |
FROM npc_marca maa | |
ORDER BY conteo DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment