I still prefer the single query method, however, as it allows the query to only run once, instead of several times in a loop.
Try this (untested): SELECT object_id, attributes.attribute_id, attribute_name_string, object_id = <dtml-sqlvar object_id type=string> AS checked FROM objects , attributes WHERE attributes.attribute_id = objects.attribute_id; Use the 'checked' column to determine which items to check. One problem is that this will only select attributes which are assigned to some object, i.e. it will miss unassigned attributes. You could probably play around with making this an outer join and correct that problem. -jfarr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi! I'm a signature virus. Copy me into your .sig to join the fun! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~