I'm creating an image gallery with albums. The gallery owner can first create one or more albums, and then create images to add to those albums. I'm having to use multiple view templates to pull this off. Regardless, here's what is hanging me up. Here is the core of my stored procedure:
DECLARE @MyString VARCHAR(MAX)
SELECT @MyString = ISNULL(@MyString + ' ', ' ') + CAST(AlbumID AS VARCHAR(10)) + ' '
FROM BD_AlbumGallery
WHERE ImageID = PROBLEM HERE... Dont know what to do <---
ORDER BY AlbumID
SELECT a.[ImageID]
,a.ImageFile
,a.[ImageTitle]
,a.[ImageCaption]
,a.[Description]
,a.[Active]
,b.[AlbumID]
,b.[ImageID]
,c.[ListingID]
,c.[Active]
,c.[LevelID]
,c.[Title]
,@MyString AS AlbumClass
FROM BD_Gallery A
JOIN BD_AlbumGallery B
ON a.ImageID = b.ImageID
JOIN BD_Listing C
ON a.ListingID = c.ListingID
WHERE a.ListingID = @passedListingID
AND a.Active = 1
AND c.Active = 1
AND c.LevelID > 5
So the problem is, the data is retrieved within a LI and one at a time of course... guess that's the obvious... to display properly in my gallery template.
The only issue I'm having is I need the @MyString AS AlbumClass to be tied to a.ImageID, or b.ImageID, as they are the same.
The reason is, the albums in the template are defined by a class.
<li class="12 24 15 17">Rest of my code for a single image result</li>
So the AlbumID's being utilized as class names allows me to assign them to the jQuery dropdown category/album list that's in a template right before this one. I was thinking of a SubQuery. Ultimately, I need the results (for other reasons) to display in one result set.
Please help.. Still trying to push my way through the learning curves.
Thanks!
- Patrick