Estimados.
Utilizo SS2000 SP4
Como veran en este caso realizo un temporal de un count y luego hago
el select, quisiera unificar la consulta par no pasar por la temporal.
drop table #Profes
Select codprof,codramo,codsecc,count(*) Horas
Into #Profes
From ra_horari
Where ano 08
group by codprof,codramo,codsecc
Select distinct
p.rut,p.nombres,p.ap_pater,p.ap_mater,p.sexo,p.mail,codsede
From ra_profes P Inner Join #Profes TP
On p.rut=tp.codprof
Inner Join ra_ramo R
On tp.codramo=r.codramo
Inner Join ra_horari H
On tp.codramo=h.codramo and tp.codsecc=h.codsecc and
tp.codprof=h.codprof
La segundo que quisiera hacer es tener el MAX de la columna codsede de
la tabla ra_horari
Atte.
Penta.
Leer las respuestas