我有两个mysql数据库。我必须比较第一个数据库中的一个表的列数据与第二个数据库的列数据。在这两个数据库中,表名和列名都是相同的。我必须找到常见的数据。该列是一个varchar字段。但问题是“纽约时代”,“纽约时代”和“纽约时代”应该被视为普遍。我无法生成sql查询。这是我尝试过的程序
drop procedure if exists test;
delimiter #
create procedure test()
begin
declare v_max int unsigned default 243;
declare v_counter int unsigned default 1;
declare pName varchar(255);
start transaction;
while v_counter < v_max do
select t.property_name from t.property where t.property_id=v_counter into pName;
SELECT distinct b.property.property_name,b.property.property_id from b.property where b.property.property_name like '%'+pName+'%'
set v_counter=v_counter+1;
end while;
commit;
end #
delimiter ;同样可以比较吗?