常用sql语句

选出表中前10条记录

SELECT   EVENTID FROM   EMERGENCYEVENT   WHERE ROWNUM <=10  ORDER BY  EVENTID ;

对DATE类型字段的处理

UPDATE FIBERMONITOR_REALTIME SET ISFINISHED=1 WHERE RECTIME=to_date('2009-4-23 10:16:05','yyyy-mm-dd hh24:mi:ss')
。。。。继续更新中。

 

嵌套查询:

select SHIPNAME,VOYAGENUM,(select DESCRIPTION from GIS_LOCATIONS where LOCATION in(select distinct LOCATION1 from GIS_WORKORDER b,GIS_WPMATERIAL c  where b.WONUM=c.WONUM)) PORTNAME1,(select DESCRIPTION from GIS_LOCATIONS where LOCATION in(select distinct LOCATION2 from GIS_WORKORDER b,GIS_WPMATERIAL c
where b.WONUM=c.WONUM)) PORTNAME2,INARRIVALTIME,LEAVEDTIME,INTENDARRTIME,ITEMQTY,STATUS from GIS_WORKORDER b,GIS_WPMATERIAL c
where b.WONUM=c.WONUM

 


select a.* ,b.* from MDLAYERTREE a,MDLAYERINFO b where a.NAME=b.LAYERNAME and a.PARENTID=14 and (b.DATATYPE='管

线' or b.DATATYPE='管线线')  order by a.ORDERINDEX

 

 

你可能感兴趣的:(sql语句)