Hello, I have two tables. bands, and gigs.
Bands holds all our new bands, and gigs holds all our gigs.
I am trying to write a query which will list the last 5 added bands, and then ouput the number of gigs the band has. (band.id, is put into gigs.bandid)
I have this at the moment.
SELECT top 5 bands.id, bands.bandname, Count(*) AS intTotal
from bands
join gigs on
gigs.BandID=bands.id
WHERE gigdelete = 0 AND gigs.gigdate>=getdate()
group by bands.id, bands.bandname
order by bands.id desc
It works fine, however it only lists the last 5 added bands who have gigs. Rather than the top 5 bands, which may contain bands with no gigs.