October 7, 2002 at 9:07 am
Hi there,
If I multiple rows with a unique ID but the number of rows are dynamic, like I could have 1 or 50 would I have to create a join for each and how in the world would I know how many joins to do?
This is the code that returns multiple rows I want one comma delimited one per unique id that I can use for a mailmerge:
select p.people_code_id,
c.short_desc as Testt,t.medium_desc as TestType,t.alpha_score_1,t.alpha_score_2,t.alpha_score_3,convert (varchar,t.test_date,101)
from testscores t,people p, code_test c, code_testtype tt
where p.people_code_id = t.people_code_id
and c.code_value = t.test_id
and tt.code_value = t.test_type
Thanks in advance
October 7, 2002 at 9:45 am
The easiest way to do this, IMHO is to use a temp or perm table and populate it with a loop to run through the main data set and get each item.
In SQL you could do self joins, but you'd have to do one for each expected row. If there are unique IDs, then you can't have multiple rows. If there is a grouping of items by ID, then is there some other identifier that makes the row unique?
Steve Jones
October 7, 2002 at 10:27 am
Hi Steve,
I guess the test and testtype together would make it unique. I mentioned joins because someone else mentioned it in another posting. Could it be possible to use a coalese statement?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply