Les, Without changing your table structure significantly, you will probably have to leave it as is. Jim Wright had the right idea (no pun intended) :) It would be a better design if you have a 'relation' table that all it has is 'photoid' column and 'themeid' column. Then that table would have one record representing each relationship, so for your photos that belonged to two different themes, there would be two records, each one with the same photoid, but a different themeid. Then you would remove the theme_id column altogether from your photos table. Then you can use the code Jim Wright wrote for you (again, no pun intended!) :)
Hope this helps. Dave ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267873 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4