Why not make a new SELECT statement in the countries table and put a WHERE country_id IN (the list)?
Where "the list" is te 6,7,8, etc Good luck! Fabio Terracini Protoculture wrote: >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. > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206219 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54