I have an old table of comments made to a web site in which no user 
registration was required, but commenters were required to enter an email 
address.  The system had little verification and users could enter bogus 
addresses, but most people did enter their real email address.

The new system requires user registration and new comments are now tied 
directly to a user account.  What I'd like to do is link any newly 
registered users to their old comments by using the email address.  It's 
imperfect, but better than nothing.  In the comments table below old 
comments have the name and email columns populated, while new comments 
have the userid populated instead.

users
------------
userid     int
username   varchar
email      varchar
...

comments
------------
commentid  int
userid     int
name       varchar
email      varchar
comment    varchar
...

Is there a single SQL query that could set userid in the comments table 
based on linking the email address in the two tables?  I can easily do it 
by looping over the users table and querying the comments table, but 
that's potentially a lot of queries. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319779
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to