mardi 4 août 2015

using mysql query to fill the rows of an empty table

I need to analyze some data in mysql and I'm trying to create a new table based largely on an existing table. Thus far I've created the table with a few dozen or so necessary columns. They are not identical to the columns (I could easily change this) in the query, but every column in the new table is contained in the query. The columns in the query and new table are also not found in the exact same order, but I could also change this if need be. How should I go about filling my table with all the necessary data from the query--100,00ish rows? Here is the format of the query:

select t2.name as agent,t1.* from
(select s.year, s.wk, t.* from sales s 
join transaction t
on s.id = t.id) t1,

(select s.year, s.wk, t.* from sales s 
join transaction t
on s.id = t.id) t2 

where t1.id=t2.id
and 
t1.name<>t2.name



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire