mysql - How to fetch data from two db and insert into temp table, using SQL? -
i have 2 databases old
, new
. want count record both databases , insert new temporary table table name.
i created temporary table:
create temporary table tempemp (tablename varchar(50),northwindcount int(11),dest_northwindcount int(11));
and counted records:
select (select count(*) northwind.orders) northwind_cnt, (select count(*) dest_northwind.orders) dest_northwind_cnt;
how can insert temp table?
dunno mysql, in ms sqlserver t-sql, you'd this:
insert tempemp( tablename,northwindcount,dest_northwindcount) select '???' table make, (select count(*) northwind.orders) northwindcount, (select count(*) dest_northwind.orders) dest_northwindcount
my syntax might little off, general idea insert statement can have select clause instead of values clause. maybe similar in mysql?
Comments
Post a Comment