Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Consulta SQL en Firebird (https://www.clubdelphi.com/foros/showthread.php?t=42178)

Nelly 05-04-2007 20:54:02

Consulta SQL en Firebird
 
Hola.... Es correcta esta consulta????, osea he utilizado bien la estructura, utilizo Firebird

Código SQL [-]
select ca.seccion||'  '||ca.tipo_casilla as casilla,
(select count(rep_casilla)from casilleros
where rep_casilla='PROPIETARIO 1' and sec_cuid=ca.seccion
     and tipo_casilla=ca.tipo_casilla group by sec_cuid,tipo_casilla) as Propietarios,
(select count(rep_casilla)from casilleros
where rep_casilla='SUPLENTE' and sec_cuid=ca.seccion
     and tipo_casilla=ca.tipo_casilla group by sec_cuid,tipo_casilla) as Suplentes
from casillas ca inner join casilleros c on ca.cve_casilla=c.cve_casilla
where ca.fecha_eleccion='20.05.2007'
group by ca.seccion,ca.tipo_casilla

poliburro 06-04-2007 05:18:48

Dos recomendaciones.

1 Indenta tus sentencias, por que es un martirio leerlas hechas una sopa
2 Utiliza nombres descriptivos en tus alias, eso hará más sencillo leer la consulta


La franja horaria es GMT +2. Ahora son las 09:05:04.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi