busboy
December 30, 2010, 6:43pm
1
r937, is a query somewhat like this going to be possible? I’m just trying to take the first registration date of a user and apply it to their most recent duplicate account.
Thanks!
update users set date = (select date from users where uID = '2637') where uID = '10576';
You shouldn’t call your column DATE, since that is a reserved word in MySQL. Unless you like putting backticks around your column names
Did you try that query?
busboy
December 30, 2010, 8:14pm
3
Meaning I should add ticks around DATE like the following?
UPDATE users SET ‘DATE’ = (SELECT DATE FROM users WHERE uID = ‘2637’) WHERE uID = ‘10576’;
Backticks, not normal single quotes. But it would be better to give that column another name, like registration_date or whatever.
busboy
December 30, 2010, 9:51pm
5
Can you give me an example? Backticks is a new thing to me.
I don’t have them on my keyboard (and don’t remember the ascii code), but you can google for it
Immerse
December 31, 2010, 9:00am
7
Backtick: `
US layout keyboards have them on the same button as tilde: ~ in the top left, underneath the ESC button.
So your query would be:
UPDATE users SET `DATE` = (SELECT `DATE` FROM users WHERE uID = '2637') WHERE uID = '10576';
(I haven’t tested this, so I don’t know if it works)
But, as Guido mentions, it’s best not to use column names that are reserved words in MySQL.