Ivan Baxter wrote:
> mysql> create table tempdata ( mass real, intensity real, lowmass real,
> highmass real, refmass real, sumintensity real );
> mysql> insert into tempdata (sumintensity) select sum(intensity) from tempdata
> where mass between 'lowmass' and 'highmass';
> ERROR 1066: Not unique table/alias: 'tempdata'
> can anyone tell me what I am doing wrong? Is it possible to do what I am
> talking about with Mysql, or should I write a perlscript to do this line by
> line?? Would I have to copy all the data to a single table, or can I pull data
> from seperate tables??
Depending on your version, a subselect is allowed in INSERT INTO but you
must return all the columns in the select using ANOTHER table so:
INSERT INTO tempdata
SELECT select 0, sum(intensity), 0, 0, 0, 0
where mass between 'lowmass' and 'highmass';