On Tue, Feb 24, 2009 at 9:25 PM, Jim McAtee <jmca...@mediaodyssey.com> wrote:
>>
> 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
> ...


UPDATE comments
SET userID = (
        SELECT userID
        FROM users
        WHERE users.email = comments.email
)



-- 
Matt Williams
"It's the quest

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:319781
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