Item Count question
I think this is more of a SQL query statement question rather than Coldfusion, but I'll attempt to explain what I'm trying to do.
I have two tables. One has a list of artwork and an artistID value is associated with each piece of artwork. That artistID value corresponds with a separate table that has artistID, artistFirst and artistLast values. On my CF page, I'm calling a random list of 20 records. My current SQL statement looks like this:
SELECT artgallery.imageID, artgallery.imageNum, artgallery.artistID, artists.artistID, artists.artistFirst, artists.artistLast
FROM artgallery, artists
WHERE artgallery.artistID = artists.artistID
ORDER BY RAND()
LIMIT 20
What I'm trying to figure out is how to display how many pieces of artwork an artists has in the database. I want it to display like this on the page:
Leonardo da Vinci - 20 works of art
The 20 would show that Leonardo da Vinci's artistID shows up 20 times in the main (artgallery) table. I'm stuck on figuring that one piece out.
