Query to insert data

in table1 i hvae columns E1,E2, E3,E4,E5,P1,P2,P3,P4,P5 if the values in e1,e2,e3,e4,e5,e6 are not null or blank i want to insert the data in table2 having fields EMAIl & Pass id it does not exists , else update

which database system are you using? mysql?

also, where did e6 come from? it is not a column in table1

and which values do you want to insert into table2? from which columns in table1?

table1 has 10 columns E1— E5 & P1-- P5 with data if any column from table1 ie E1-- E5 then skip the blank column rest data to be inserted in table2 having columns EMAIL & PASS EMAIL coulmn will contain data from column E1–E5 & pass will contain data P1—P5 if the E1 data already exists tehn update ELSE iNSERT i hope its clear x,z,c was the data from columns E

there is no E6
using sQl server

please explain “if the data already exists then update”

if which data exists where? then update what?

if the same data from e1… to e5 exists the update table2, else insert if new data

it can be either update or delete the existing

http://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html

update which columns in table 2 with what???

you do not seem to understand that we find your specifications to be very vague

perhaps you could give some sample data for each table and show exactly what needs to be done that way