Ver Mensaje Individual
  #7  
Antiguo 08-08-2007
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Reputación: 21
gluglu Va por buen camino
Ya parece que sí funciona !

Código SQL [-]
begin

  Select BOJ.BOOKINGNO
  from BOOKINGS_OBJECTS BOJ
  left join BOOKINGS BO
    on BO.BOOKINGNO = BOJ.BOOKINGNO
  where
    BOJ.BUILDINGNO = :"BUILDING_NO" and
    BOJ.OBJECTNO = :"OBJECT_NO" and 
    BOJ.DATETO <= :"DATE_SP" and
    BO.STATUS = 3
    Into BOOK_NO;

  if (not :"BOOK_NO" is Null) then
    SUSPEND;
  else begin

    Select BOJ2.BOOKINGNO 
    from BOOKINGS_OBJECTS BOJ2
    left join BOOKINGS BO2
      on BO2.BOOKINGNO = BOJ2.BOOKINGNO
    where
      BOJ2.BUILDINGNO = :"BUILDING_NO" and
      BOJ2.OBJECTNO = :"OBJECT_NO" and
      BOJ2.DATEFROM <= :"DATE_SP" and
      BOJ2.DATETO >= :"DATE_SP" and
      BO2.STATUS <= 2
      Into BOOK_NO;
    SUSPEND;

  end

end
__________________
Piensa siempre en positivo !
Responder Con Cita