文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>abap 数据库操作部分

abap 数据库操作部分

时间:2010-08-20  来源:漠北的天空

DATA c_tb TYPE zcouy_tb OCCURS 0 WITH HEADER LINE .

 

*----Insert------
c_tb-countryid = 000 .
c_tb-countryname = 'kk' .
c_tb-cityid = 13 .
 append c_tb .

c_tb-countryid = 000 .
c_tb-countryname = 'jj' .
c_tb-cityid = 14 .
 append c_tb .

loop at  c_tb .
INSERT INTO  zcouy_tb  VALUES  c_tb .
IF sy-subrc = 0 .
  WRITE : / ' insert success ' .
ENDIF .
endloop .


*----update -----
update zcouy_tb
cityid = 1
where cityid = 14 .


*----delete -----
delete from  zcouy_tb  where  countryname = 'CH' .


*----select -----
SELECT *
 FROM zcouy_tb
INTO  c_tb
 where cityid = 1 .
 WRITE : / c_tb .
ENDSELECT  .

 

*----max,min,group by ,having -----
DATA:d_countryid TYPE zcouy_tb-countryid ,
     d_maxname TYPE zcouy_tb-countryname ,
     d_minname TYPE zcouy_tb-countryname ,
     d_cityid TYPE zcouy_tb-cityid ,
     num TYPE i .

SELECT countryid MAX( countryname ) AS max  MIN( countryname ) COUNT( *

cityid
INTO (d_countryid ,d_maxname , d_minname ,num, d_cityid)
FROM zcouy_tb
GROUP BY countryid cityid
HAVING COUNT( * ) > 0
ORDER BY max DESCENDING .
 WRITE : / d_countryid,d_maxname,d_minname,num,d_cityid .
ENDSELECT  .

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载