0

I have a table1 with only two columns id and password and so i had to insert values with id and password where id not like 'ADMIN%'... I tried my query as below:

  1. insert into table1 values('','') where id not like 'ADMIN%' (doesn't work)
  2. insert into table values('','') select id,password from table1 where id not like 'ADMIN%' (doesn't work)

Both queries didn't work. please help !!

ernd enson
  • 1,764
  • 1
  • 14
  • 29

3 Answers3

1

Something like

insert into table (id, password) select id,password from table1 where id not like 'ADMIN%' 

As per http://dev.mysql.com/doc/refman/5.1/en/insert-select.html

Chrisky
  • 567
  • 3
  • 9
1

MYSQL INSERT does not work with the WHERE clause. please check:

MySQL Insert Where query

Community
  • 1
  • 1
Clark Superman
  • 373
  • 2
  • 13
-1

insert into table ('id', 'password'); select id,password from table1 where id not like 'ADMIN%'; semicolons...

Try this...

Kanjah77
  • 25
  • 6