Ver Mensaje Individual
  #1  
Antiguo 16-11-2007
Avatar de maxid
maxid maxid is offline
Miembro
 
Registrado: ene 2006
Posts: 38
Reputación: 0
maxid Va por buen camino
Firebird soporta Vistas en linea?

he querido hacer una vista en linea, como por ejemplo:

Código SQL [-]
select
 cp.Nombre,
 e.nombre as nomesp,cpro.nombre as nompro,
 min(fecha) PrimeraConsulta,
 max(fecha) UltimaConsulta,
 count(cp.Nombre),
 (SELECT
first 1
  DETTABLAS.CODIGO,
  DETTABLAS.DESCRI
FROM
  HISTORIAS_CLINICAS
  INNER JOIN DETHISTORIAS ON (HISTORIAS_CLINICAS.NUMINT = DETHISTORIAS.NUMINT)
  INNER JOIN DETTABLAS ON (DETHISTORIAS.NUMTAB = DETTABLAS.NUMINT)
where
  DETTABLAS.TABLA = 3
and
   HISTORIAS_CLINICAS.pacien=HISTORIAS_CLINICAS.pacien
group by
  DETTABLAS.CODIGO,
  DETTABLAS.DESCRI
having count(*) = 1

order by max(HISTORIAS_CLINICAS.FECHA) desc) x
 from
 vw_diagpac
 LEFT OUTER pacien
 turnos t, cuentas cp, practicas p,
 horarios h, cuentas cpro, especialidades e

 where
     t.pacien = cp.numint And
     t.practi = p.Numero And
     t.horari = H.numint and
     h.profes=cpro.numint and
     h.especi=e.numero  and
     cambio in(2,3,5) and
     h.fecha between '10/01/2006' and '05/31/2007'

group by
 cp.Nombre,
 e.nombre,
 cpro.nombre
order by e.nombre,cpro.nombre

y me da error que no conoce el select
esto está soportado en mysql, oracle, postgres y hasta en mssql
__________________
Maestro no solo es el que conoce sino el que comparte lo que sabe.

Última edición por jhonny fecha: 16-11-2007 a las 18:44:17. Razón: Coloque las etiquetas SQL
Responder Con Cita