/* THIS IS THE QUERY TO CHECK FOR BUG */
SELECT BannerID, Sum(TotHrs) from (
select SiteNo, BannerID, Sum(DailyNonCredHrs)
as TotHrs
from fnNonCreditDetailsRpt
('08/20/01','12/18/01',82)
Where DailyNonCredHrs IS NOT NULL
Group By SiteNo, BannerID
UNION
select SiteNo, BannerID, Sum(DailyNonCredHrs)
as TotHrs
from fnNonCreditDetailsRpt
('08/20/01','12/18/01',83)
Where DailyNonCredHrs IS NOT NULL
Group By SiteNo, BannerID
UNION
select SiteNo, BannerID, Sum(DailyNonCredHrs)
as TotHrs
from fnNonCreditDetailsRpt
('08/20/01','12/18/01',85)
Where DailyNonCredHrs IS NOT NULL
Group By SiteNo, BannerID
UNION
select SiteNo, BannerID, Sum(DailyNonCredHrs)
as TotHrs
from fnNonCreditDetailsRpt
('08/20/01','12/18/01',87)
Where DailyNonCredHrs IS NOT NULL
Group By SiteNo, BannerID
UNION
select SiteNo, BannerID, Sum(DailyNonCredHrs)
as TotHrs
from fnNonCreditDetailsRpt
('08/20/01','12/18/01',89)
Where DailyNonCredHrs IS NOT NULL
Group By SiteNo, BannerID
) allCompLab
Group By BannerID
Having Sum(TotHrs) < 0