update talbe1 set table1.field2=(select field2 from table2 where table1.filed1=table2.field1);
-- 把表table2的字段field1更新表tabel1的字段field1,条件为表table1的字段field2后六位等于table2的字段field2 update table1 set table1.field1=(select table2.field1 from table2 where substr( table1.field2,(length(table1.field2)-6+1),6 ) =substr( table2.field2,(length(table2.field2)-6+1),6 );
5 查询时间:
(a)select to_char(clqssj,'yyyymmdd') as date1 from table1 where to_char(clqssj,'yyyymmdd') like'%2005101%'; (b)select clqssj as date1 from table1 where clqssj between to_date('2005-10-09','yyyy-mm-dd') AND to_date('2005-10-11','yyyy-mm-dd') ;
6 将一表中的数据备份到新表中:
createtable newtable asselect*from oldtable;
6 获取某一字段的后八位:
SELECT NVL(field1,'') AS field1, substr( NVL(field2,''),(length(NVL(field2,''))-8+1),8 ) AS field2 FROM table1;
7 批量插入:
insertinto table1 select*from table2;
8 查询重复记录:
SELECT A.field1 FROM table1 A GROUPBY CHINESENAMEA.field1 HAVING ( (SELECTCOUNT(*) FROM table1 BWHERE b.chinesename = a.chinesename ) >1 )