I've been evaluating/using VistaDB on a project I'm writing, and ran into a problem, as I detailed in the ongoing review.
I wanted to use a function to return the result of a query on a pivot table as a comma delimited list.
DECLARE @r VARCHAR(200)
SELECT @r = ISNULL(@r+',', '')
+ gt.description
FROM GameTags gt JOIN Game2Tag g2g ON
gt.keygametag = g2g.keygametag
WHERE g2g.keygame = 1
SELECT @r
But it only returned the last row.
The (relevant) structure of the tables is as follows:
GameTags |
KeyGameTag int |
Description varchar(50) |
Game2Tags |
KeyGame2Tag int |
KeyGame int |
KeyGameTag int |
So, I wanted to return the a comma-delimited string of the Description fields for all of the matching tags, but it returned a string with only the description of the final record. First, does anyone see anything wrong with the SQL? I'm pretty sure it's right, but don't have any quick way to test it currently against any other dbs. And second, does anyone know of another way to do the same thing without cursors?