i want to update few table 1 fields to table 2 both have same primary keys
please help me how to do it
table1(id,sno,billingsys,name,phone) has data in all fields
table2(id,sno,billingsys,a/cno,contactname,contactphone)has data in primarykey field and a/cno
Primary kew for both table are (id,sno)
(id is text,sno is Number)
i want to update contactname,contactphone with name and phone fields where id=id and sno=sno are same in both table
Please help me to write a query
i wrote it like
Expand|Select|Wrap|Line Numbers
- Update table2 set (SELECT name FROM table1 WHERE table1.ID = table2.ID and table1.sno = table2.sno ) as contactname,
- (SELECT phone FROM FROM table1 WHERE table1.ID = table2.ID and table1.sno = table2.sno) as contactphone where id=id and sno=sno