What do you mean by 'looping'? A SELECT, in SQL, is already producing a
sequence, kind of a for-each. If you need two for-each's:
foreach ( i in set_of_is)
foreach ( j in set_of_js)
you can 'get' it, in SQL, like this:
SELECT ...
FROM set_of_is, set_of_js
and it is the FROM clause, not the SELECT clause, which 'speaks' of the two
loops. The SELECT clause just tell what we want (from the 'loops' ).
If your two foreach loops need to be 'in-synch', not the Justin Timberlake
thing, but more like imposing a condition that has to be enforced, at this
moment:
foreach ( i in set_of_is)
foreach ( j in set_of_js)
if( i.City <> j.City) continue
... do something otherwise, here
then you can use something like:
SELECT ...
FROM set_of_is INNER JOIN set_of_js
ON set_of_is.City = set_of_js.City
or
SELECT ...
FROM set_of_is, set_of_js
WHERE set_of_is.City = set_of_js.City
but again, it is the FROM clause which 'speaks' of the 'loops', helped, or
not, with a WHERE clause (or with a ON clause of a JOIN).
So, 'yes' we can 'loop', but that is only 'as if we were looping', and it is
done in the FROM clause, not in the SELECT clause.
Hoping it may help,
Vanderghast, Access MVP