K,
Thanks for the reply. Here's a piece of my query:
select jbtb.jbid, sitb.sina,
case when datepart(dw,altb.alts)= 4 then altb.alts else null end as Wed,
case when datepart(dw,altb.alts)= 5 then altb.alts else null end as Thurs,
case when datepart(dw,altb.alts)= 6 then altb.alts else null end as Fri,
case when datepart(dw,altb.alts)= 7 then altb.alts else null end as Sat,
case when datepart(dw,altb.alts)= 1 then altb.alts else null end as Sun,
case when datepart(dw,altb.alts)= 2 then altb.alts else null end as Mon,
case when datepart(dw,altb.alts)= 3 then altb.alts else null end as Tues,
intb.pbid, pbtb.pbna, intb.zgid, zgtb.zgna,
altb.alts,intb.indl, intb.indt as mindate, jbna from jbtb
join jptb on jptb.jpid = jbtb.jbid
JOIN intb ON intb.InId = (select min(intb.inid) from intb where intb.JpId=jptb.JpId
and intb.InDt = (select min(intb.InDt) from intb where
intb.jpid=Jptb.jpid))
join altb on altb.alid = (select min(altb.alid) from altb where altb.jpid=jbtb.JbId
and altb.alts = (select min(altb.alts) from altb where
altb.jpid=jbtb.jbid and stid = 10020 and altb.alts >= @start and altb.alts <= @end))
join pbtb on pbtb.pbid = intb.pbid
join zgtb on zgtb.zgid = intb.zgid
join fstb on fstb.fsid = jptb.fsid
join smtb on smtb.smid = fstb.smid
join sitb on sitb.siid = smtb.siid
where InDt >= @start and Indt <= @end
I'm using Crystal 9, against a SQL 2K db.
Example data:
sina Wed Thurs Fri Sat Sun Mon Tues
---- --- ----- --- --- --- ---- ----
RDS Null 2004-4-8 Null Null Null Null Null
RDS 2004-4-7 Null Null Null Null Null Null
Expected Output
Page Header 4/7/2004 4/8/2004 4/9/2004 and so on
Group - RDS
1 1
Tony