Did you have your answer? I believe you are trying to get the country's names of the country's ids '6,31,32,33,35,36,', right?
I would do this: SELECT COUNTRY_NAME FROM COUNTRY WHERE COUNTRY_ID IN (SELECT COUNTRY_ID FROM SOMETABLE WHERE CLIENT_ID = 15421) Johnny > I'm new to stored procedures ( in MS SQL ) and need help with the > following query... > > Essentially what my procedure will do is take an argument of CLIENT_ID > and return a list of COUNTRIES. Simple enough, cept for the fact that > the database does not return a single ID, but a list of IDS that > pertain to the COUNTRY_ID of another table. eg... passing in CLIENT_ID > of 15421 returns a list like the following... '6,31,32,33,35,36,' ( > Yes I know this isn't the best way for it to be set up ). > > so what I need to do in MSSQL is perform a query to grab that list of > comma seperated numbers, put those numbers into an array OR a list and > then loop over that array/list and and return the results ( which is a > list of country names ). > > Another thing I thought of was to create a temporary table and place > the list ( 6,7,8,13,4 etc ) into that, but then I would still have to > be able to loop over each element, which I'm not sure how to do in > MSSQL. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206237 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

