- 论坛徽章:
- 0
|
oracle 求助 急!!! 在线等候~~~
注意oracle表,列名区分大小。
实例:
SQL>; create table a (personid number,name varchar2(40));
Table created
SQL>; insert into a values(1,'n1');
1 row inserted
SQL>; insert into a values(2,'n2');
1 row inserted
SQL>; create table b (personid number,name varchar2(40));
Table created
SQL>; insert into b values(0,'n1');
1 row inserted
SQL>; insert into b values(0,'n2');
1 row inserted
SQL>; select a.name,a.personid a_id,b.personid b_id from a,b where a.name=b.name;
NAME A_ID B_ID
---------------------------------------- ---------- ----------
n1 1 0
n2 2 0
SQL>; update b set personid=(select personid from a where b.name=a.name and rownum<2);
2 rows updated
SQL>; select a.name,a.personid a_id,b.personid b_id from a,b where a.name=b.name;
NAME A_ID B_ID
---------------------------------------- ---------- ----------
n1 1 1
n2 2 2
SQL>; |
|