Home » SQL & PL/SQL » SQL & PL/SQL » PREVIOUS YEARS
PREVIOUS YEARS [message #196487] Thu, 05 October 2006 10:04 Go to next message
PRGMER
Messages: 5
Registered: June 2006
Junior Member
hi folks: new to sql...trying to write a sql prgm to get the current year data along with three previous year data.
my script reads

select pardat.nbhd,
pardat.luc,
htpar.action,
htpar.resact
from aprval,asmt,htpar,pardat
where asmt.rolltype = 're'
and asmt.cur = 'y'
and aprval.revreas in ('70','80')
and pardat.nbhd not like 'c%'
and asmt.taxyr = '2005'

would like to get 2004,2003,2002 years data for
htpar.action and htpar.resact...how do i get this to print on
my report..do i need to add any thing to my select statement to achieve this? will sql do this automatically?
Re: PREVIOUS YEARS [message #196490 is a reply to message #196487] Thu, 05 October 2006 10:20 Go to previous message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
What about ?

select 
amt.taxyr,
pardat.nbhd,
pardat.luc,
htpar.action,
htpar.resact
from aprval,asmt,htpar,pardat
where asmt.rolltype = 're'
and asmt.cur = 'y'
and aprval.revreas in ('70','80')
and pardat.nbhd not like 'c%'
and asmt.taxyr in ('2005', '2004', '2003', '2002')
order by amt.taxyr
Previous Topic: constraint types
Next Topic: Recordset Paging Example
Goto Forum:
  


Current Time: Fri Dec 02 20:27:49 CST 2016

Total time taken to generate the page: 0.13822 seconds