Help with MySQL insert query?

I'm having some trouble with an insert using a subquery. I have it half working... my problems start when I try to add information into additional fields that aren't pulled by the subquery. What I have right now: INSERT INTO `phpbb_users` (user_id, username, user_password, user_regdate, user_email,... show more I'm having some trouble with an insert using a subquery. I have it half working... my problems start when I try to add information into additional fields that aren't pulled by the subquery.

What I have right now:

INSERT INTO `phpbb_users`
(user_id, username, user_password, user_regdate, user_email, user_website, user_from, user_avatar)
(SELECT u.id, u.forum_user, u.password, UNIX_TIMESTAMP(u.date_created), u.email, p.web, p.hometown, u.avatar FROM users u JOIN profiles p ON u.id=p.user_id WHERE u.id = 4)

Now that all works just fine. But I also need to add info that isn't already stored elsewher in the database into some additional fields in the phpbb_users table. So I came up with this:

INSERT INTO `phpbb_users`
(user_id, username, user_password, user_regdate, user_email, user_website, user_from, user_avatar, user_avatar_type, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_attachsig)
((SELECT u.id, u.forum_user, u.password, UNIX_TIMESTAMP(u.date_created), u.email, p.web, p.hometown, u.avatar FROM users u JOIN profiles p ON u.id=p.user_id WHERE u.id = 4), 2, 0, 0, 1, '-5.00', 1)

Unfortunately, this gives me a syntax error, and I'm not sure where my syntax is screwed up. If it helps, the error I'm getting is as follows:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT u.id, u.forum_user, u.password, UNIX_TIMESTAMP(u.date_created), u.email,' at line 3
Update: Yay! It works now! Thanks, truthbetold and noonehome2day.
5 answers 5