Limit SQL statement to year -
i want take 2 following statement , results 2013.
select count(distinct cast(c1.caseseqnumber varchar) + '-' + cast(c1.year varchar)), count(distinct cast(c2.caseseqnumber varchar) + '-' + cast(c2.year varchar)) caseparticipants c1 left join caseparticipants c2 on c1.year=c2.year , c1.caseseqnumber=c2.caseseqnumber , c2.participanttype = 'appellant rep 1'
and second one
select distinct c1.caseseqnumber, c1.year caseparticipants c1 left join caseparticipants c2 on c1.year=c2.year , c1.caseseqnumber=c2.caseseqnumber , c2.participanttype = 'appellant rep 1' c2.year null order year asc, caseseqnumber asc
thanks!
if looks have year
field, add where
clause:
1:
select count(distinct cast(c1.caseseqnumber varchar) + '-' + cast(c1.year varchar)), count(distinct cast(c2.caseseqnumber varchar) + '-' + cast(c2.year varchar)) caseparticipants c1 left join caseparticipants c2 on c1.year=c2.year , c1.caseseqnumber=c2.caseseqnumber , c2.participanttype = 'appellant rep 1' c1.year = 2013
2:
select distinct c1.caseseqnumber, c1.year caseparticipants c1 left join caseparticipants c2 on c1.year=c2.year , c1.caseseqnumber=c2.caseseqnumber , c2.participanttype = 'appellant rep 1' c1.year = 2013 , c2.year null order year asc, caseseqnumber asc
Comments
Post a Comment