我有两个 Mysql 数据库。 我必须比较第一个数据库中第一个表格的列数据与第二个数据库的列数据。 在两个数据库中, 表格名称和列名称都是一样的。 我必须找到共同的数据。 列是一个 varchar 字段。 但问题在于“ Newyork times” 和“ times newyork” 和“ newyork” 。 我无法生成 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 ;
能否进行类似的比较?