MySQL Forums
Forum List  »  Newbie

Re: How can I update or replace columns in one table with columns from another table?
Posted by: Pedro Ribeiro
Date: August 12, 2004 01:03PM

Example code i'm using for something similar ...

INSERT radtemp (UserName,VLAN)
SELECT DISTINCT ui.UserName,rp.VLAN
FROM userinfo AS ui,alunos.RadiusProfiles AS rp,alunos.Bindings AS bi
WHERE rp.VLAN != 0
AND ui.UserName LIKE '%@%'
AND SUBSTRING_INDEX(ui.UserName,'@',-1) = rp.Dominio
AND ui.UserName = CONCAT(bi.User,'@',bi.Domain)
AND (bi.CodigoCurso = rp.CodigoCurso OR rp.CodigoCurso = 0);

Bad example ?? see INSERT ... SELECT
http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html

Options: ReplyQuote


Subject
Written By
Posted
Re: How can I update or replace columns in one table with columns from another table?
August 12, 2004 01:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.