[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: SQR unions ?



Allen Wong wrote:
>
>      Can SQR handle unions, if yes how can I use it ?
>
>      thanks

Hi Allan,

Yes, SQR can definitely handle SQL UNION.  Try this one case053.sqr.
--
Xavier K. Lau
SQRIBE Technologies Asia Pacific
Technical Support Engineer

E-Mail : xavier.lau@miti.com.au OR support@miti.com.au
!
!   union.sqr
!
begin-program
  do proc1
end-program

begin-setup
 declare-layout default max-lines=25 end-declare
end-setup

begin-procedure proc1
begin-select
! 'A' &dum (,1)
appt_date &ad (,5)
appt_time (,25)
appointment (,40) WRAP 35 5
 position (+1)
!  add 1 to #appt_count
!  if #current_line > {mypagemax}
!    new-page
!  end-if
from appts
union select
! 'B' &dum ,

appt_date  &ad ,
appt_time ,
appointment
from appts
order by 1 , 2
end-select
!let $sumline = 'Total Appts.  ' || to_char(#appt_count) || -
!'.  Final date = ' || &ad
!print $sumline (+2,1)
!date-time
end-procedure ! proc1