Home > Database > Mysql Tutorial > Oracle排序取第一条数据

Oracle排序取第一条数据

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:23:07
Original
2749 people have browsed it

Oracle需要更新套组的大单位, 规则是取第一个学员(套组ID最小)的单位信息。

Oracle需要更新套组的大单位, 规则是取第一个学员(套组ID最小)的单位信息。
 
采用按照SUITEID排序取第一条方法。

UPDATE sim_big_suite u SET u.org_code = (
SELECT SUBSTR(x.pilot_unit,1,4) FROM(
SELECT n.* FROM sim_student_assign n WHERE
 n.big_suite_no = 192 AND
--u.big_suite_no = n.big_suite_no AND 
n.ac_type_code = 14
AND n.fixed_year = '2013上半年' AND n.train_com = 1001 AND n.position = 'L'
ORDER BY n.suite_id
)x WHERE ROWNUM = 1
)WHERE u.ac_type_code = 14 AND u.fixed_year = '2013上半年' AND u.train_com = 1001;

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template