I'm trying to run a query that looks like this:
$DB->query("INSERT INTO table (
SELECT s.value1, s.value2, s.value3, t.value1, u.value1, u.value2, u.value3, u.value4
FROM aTable AS s
LEFT JOIN aTable2 AS u ON u.uID = s.uid
WHERE u.spent < ". $needed ."
GROUP BY s.uid, s.fid )
ON DUPLICATE KEY UPDATE
value1 = VALUES(u.value1),
value2 = VALUES(u.value2),
value3 = VALUES(u.value3),
value4 = VALUES(u.value4);
");
However this returns the error:
Unknown column 'u.value1' in 'field list'
Please note that this is the first time I'm working with MySQL at this level, so I have no idea how the DUPLICATE KEY UPDATE function works...
What i intent to do with the table is like a cache, because the infromation is fetched from some very large table