搜索

Select single max


发布时间: 2022-11-24 18:25:01    浏览次数:26 次
 1 *&---------------------------------------------------------------------*
 2 *& Report ZREPORT
 3 *&---------------------------------------------------------------------*
 4 *&
 5 *&---------------------------------------------------------------------*
 6 REPORT ZREPORT.
 7 
 8 
 9 DATA LV_ZXBLNR TYPE ZTBAR_LIST-ZXBLNR.
10 DATA LV_TIMESTAMP TYPE ZTBAR_LIST-TIMESTAMP.
11 
12 
13 
14 *ECC 方式
15 SELECT SINGLE MAX( TIMESTAMP ) ZXBLNR
16   FROM ZTBAR_LIST
17   INTO ( LV_TIMESTAMP,lv_ZXBLNR )
18   WHERE ZBARCODE = '0170019000100119010400031'
19   GROUP BY ZXBLNR.
20 
21 *GROUP BY 要排除MAX字段
22 
23 *S4 方式
24 *SELECT SINGLE  ZXBLNR
25 *  FROM ZTBAR_LIST
26 *  INTO LV_ZXBLNR
27 *  WHERE ZBARCODE = '0170019000100119010400031'
28 *  AND   TIMESTAMP = ( SELECT MAX( TIMESTAMP ) FROM ZTBAR_LIST WHERE ZBARCODE = '0170019000100119010400031').
29 
30 
31 
32 
33 
34   BREAK-POINT.
View Code
 1 *&---------------------------------------------------------------------*
 2 *& Report ZREPORT
 3 *&---------------------------------------------------------------------*
 4 *&
 5 *&---------------------------------------------------------------------*
 6 REPORT ZREPORT.
 7 
 8 
 9 DATA LV_ZXBLNR TYPE ZTBAR_LIST-ZXBLNR.
10 DATA LV_TIMESTAMP TYPE ZTBAR_LIST-TIMESTAMP.
11 
12 
13 
14 *ECC 方式
15 SELECT SINGLE MAX( TIMESTAMP ) ZXBLNR
16   FROM ZTBAR_LIST
17   INTO ( LV_TIMESTAMP,lv_ZXBLNR )
18   WHERE ZBARCODE = '0170019000100119010400031'
19   GROUP BY ZXBLNR.
20 
21 *GROUP BY 要排除MAX字段
22 
23 *S4 方式
24 *SELECT SINGLE  ZXBLNR
25 *  FROM ZTBAR_LIST
26 *  INTO LV_ZXBLNR
27 *  WHERE ZBARCODE = '0170019000100119010400031'
28 *  AND   TIMESTAMP = ( SELECT MAX( TIMESTAMP ) FROM ZTBAR_LIST WHERE ZBARCODE = '0170019000100119010400031').
29 
30 
31 
32 
33 
34   BREAK-POINT.

 

免责声明 Select single max,资源类别:文本, 浏览次数:26 次, 文件大小:-- , 由本站蜘蛛搜索收录2022-11-24 06:25:01。此页面由程序自动采集,只作交流和学习使用,本站不储存任何资源文件,如有侵权内容请联系我们举报删除, 感谢您对本站的支持。 原文链接:https://www.cnblogs.com/Anyohh233/p/16915632.html