do like this put all the table names in a temp table then follow these steps in while loop.
Then create a table results with all the required columns
for each @tablename
insert into results
select product name ,id,category... from @tablename
repeat
Then finally select distinct * from results
- - - - - - - - - - - - - - - - -代码 - - - - - - - - -------------------------------------
create table temp(id int auto_increment primary key,tblname varchar(100));
insert into temp(tblname)
VALUES('shop1_products'),('shop2_products'),('shop3_products')...('shop100_products');
select min(id),max(id) into @vmin,@vmax from temp;
select @vmin,@vmax;
create table results(productname varchar(100),id int,category varchar(100)...);
while(@vmin <= @vmax)
Do
select tblname into @tablename from temp;
INSERT INTO results(product name ,id,category...)
select product name ,id,category... from @tablename
SET @vmin=@vmin+1;
END WHILE;
select distinct * from results;