Gary Chambers <gwch...@gmail.com> writes: > INSERT INTO useraddrs(userid, addrdesc, city, stprov) > SELECT u.userid, 'Home', c.cityname, c.stateabbr > FROM users u, cities c > WHERE u.userid NOT IN (SELECT userid FROM useraddrs) > AND cid=(SELECT cid FROM cities ORDER BY RANDOM() LIMIT 1);
> I am able to achieve most of what I am trying to accomplish, but once > the random number is selected, it doesn't change. What am I missing? I believe the sub-SELECT will only get executed once, since it has no dependency on the outer query. What were you expecting to happen? regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql