壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: 纵横四海

ERP系统常用SQL集锦

    [复制链接]
发表于 2007/9/19 07:20:53 | 显示全部楼层

回复有关问题。

弱弱的问一句:
  and sysdate > e.EFFECTIVE_START_DATE
   and sysdate < e.EFFECTIVE_END_DATE
中的
> &lt 如果输入相关信息呢?

答复:我的理解,发表者本想写大于会小于号。
发表于 2007/9/19 07:43:54 | 显示全部楼层
楼主辛苦了 :)
发表于 2007/9/19 09:46:09 | 显示全部楼层

谢谢楼主 牛人一大堆啊 ,新手 也传个吧 AP付款明细

谢谢楼主  牛人一大堆啊 ,新手  也传个吧  AP付款明细

SELECT DISTINCT apv.vendor_number vendor_num,apv.vendor_name vendor_name,apv.terms_name terms_name,apv.invoice_currency_code currency_code,to_char(rvtc.creation_date,'yy-mm-dd') rcv_date,
                rvtc.subinventory subinventory,pelav.lineordertype ordertype,pcllav.item item,PLA.item_description item_desc,rvtc.transact_qty qty,
                rvtc.transact_uom uom,pla.unit_price * (1 + atca.tax_rate / 100) t_unit_price,
                rvtc.transact_qty * pla.unit_price *(1 + atca.tax_rate / 100) t_ext_price,
                rvtc.receipt_num rcv_num,pha.segment1 po_num,atca.name tax
FROM rcv_vrc_txs_cust_v      rvtc,
     ap_vendors_v            apv,
     po_cxml_line_loc_arch_v pcllav,
     po_lines_all            pla,
     po_headers_all          pha,
     ap_tax_codes_all        atca,
     PO_ECX_LINE_ARCH_V      pelav
WHERE rvtc.vendor_id = apv.vendor_id
AND rvtc.transaction_type = 'DELIVER'
AND pcllav.po_header_id = rvtc.po_header_id
AND pcllav.po_line_id = rvtc.po_line_id
AND rvtc.po_header_id = pla.po_header_id
AND rvtc.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND pcllav.po_header_id = pla.po_header_id
AND pcllav.po_line_id = pla.po_line_id
AND pcllav.tax_code_id = atca.tax_id
AND pelav.Po_Line_Id = rvtc.po_line_id
AND apv.vendor_number=nvl(UPPER('&1'),apv.vendor_number)
AND trunc(rvtc.creation_date) >= nvl(to_date('&2', 'yyyy-mm-dd'),trunc(rvtc.creation_date))
AND trunc(rvtc.creation_date) <= nvl(to_date('&3', 'yyyy-mm-dd'),trunc(sysdate))
order by apv.vendor_number,rcv_date;
发表于 2007/9/20 08:57:56 | 显示全部楼层
楼主们个个是高手,对于我这个初学者自愧不如啊
发表于 2007/10/8 16:53:02 | 显示全部楼层

俺也来个会计常用的

查看明细帐户余额
select --gb.currency_code,
gb.period_name                         "会计期间",
/*to_char(gp.start_date,'YYYYMM')        "期间范围",*/
glcc.segment1 公司代码,
ffv1.description   公司名称,
glcc.segment2                          "成本中心",
glcc.segment3                           "科目",
glcc.segment4                           "明细",
glcc.segment5                           "产品",
glcc.segment6                           "渠道",
glcc.segment7                           "备用",
glcc.concatenated_segments              "帐户",
gb.begin_balance_dr-gb.begin_balance_cr  "期初数",           
gb.period_net_dr  "本期借方发生额",           
gb.period_net_cr  "本期贷方发生额",   

gb.begin_balance_dr-gb.begin_balance_cr + gb.period_net_dr-gb.period_net_cr "期末数",
--gb.actual_flag,      
ffv1.description                     "公司名称",
ffv2.description                     "成本中心说明",
ffv3.description                     "科目说明",
ffv4.description                     "明细说明",
ffv5.description                     "产品说明",
ffv6.description                     "渠道说明",
ffv7.description                     "预算说明"        
from gl_balances gb,
      gl_code_combinations_kfv glcc,
      fnd_flex_values_vl  ffv1,
      fnd_flex_values_vl  ffv2,
      fnd_flex_values_vl  ffv3,
      fnd_flex_values_vl  ffv4,
      fnd_flex_values_vl  ffv5,
      fnd_flex_values_vl  ffv6,
      fnd_flex_values_vl  ffv7,
      gl_periods  gp   
   where gb.code_combination_id=glcc.code_combination_id
      /* and gb.actual_flag='B'*/
       and gb.set_of_books_id='1001'
       AND glcc.segment2<>'T'
       AND glcc.segment4<>'T'
       AND glcc.segment5<>'T'
       AND glcc.segment6<>'T'
       AND glcc.segment7<>'T'
       AND length(glcc.segment3)=8
       AND ffv1.flex_value_set_id='1009494'
       AND ffv2.flex_value_set_id='1009495'
       AND ffv3.flex_value_set_id='1009497'
       AND ffv4.flex_value_set_id='1009498'
       AND ffv5.flex_value_set_id='1009499'
       AND ffv6.flex_value_set_id='1009500'
       and ffv7.FLEX_VALUE_SET_ID='1009501'
       and glcc.segment1=ffv1.flex_value
       and glcc.segment2=ffv2.flex_value
       and glcc.segment3=ffv3.flex_value
       and glcc.segment4=ffv4.flex_value
       and glcc.segment5=ffv5.flex_value
       and glcc.segment6=ffv6.flex_value
       and glcc.segment7=ffv7.flex_value
       AND GP.PERIOD_NAME=GB.PERIOD_NAME
      
       and gb.period_name between '2007-01' and '2007-07'
       AND glcc.segment3 like '66011801%'
       --and glcc.segment7='0'
       and glcc.segment1 like '860000%'
       and gb.currency_code='CNY'
       and gb.actual_flag = 'A'
       and gb.begin_balance_dr-gb.begin_balance_cr + gb.period_net_dr-gb.period_net_cr <>'0'
发表于 2007/10/8 16:54:02 | 显示全部楼层

查看汇总帐户余额

select --gb.currency_code,
gb.period_name                         "会计期间",
/*to_char(gp.start_date,'YYYYMM')        "期间范围",*/
glcc.segment1||'-'||ffv1.description   "公司代码及名称",
/*glcc.segment2                          "成本中心",
glcc.segment3                           "科目",
glcc.segment4                           "明细",
glcc.segment5                           "产品",
glcc.segment6                           "渠道",
glcc.segment7                           "备用",*/
--glcc.concatenated_segments              "帐户",
glcc.segment3   "帐户",
gb.begin_balance_dr-gb.begin_balance_cr  "期初数",           
gb.period_net_dr  "本期借方发生额",           
gb.period_net_cr  "本期贷方发生额",   

gb.begin_balance_dr-gb.begin_balance_cr + gb.period_net_dr-gb.period_net_cr "期末数",
--gb.actual_flag,      
ffv1.description                     "公司名称",
ffv2.description                     "成本中心说明",
ffv3.description                     "科目说明",
ffv4.description                     "明细说明",
ffv5.description                     "产品说明",
ffv6.description                     "渠道说明"        
from gl_balances gb,
      gl_code_combinations_kfv glcc,
      fnd_flex_values_vl  ffv1,
      fnd_flex_values_vl  ffv2,
      fnd_flex_values_vl  ffv3,
      fnd_flex_values_vl  ffv4,
      fnd_flex_values_vl  ffv5,
      fnd_flex_values_vl  ffv6,
      gl_periods  gp   
   where gb.code_combination_id=glcc.code_combination_id
      /* and gb.actual_flag='B'*/
       and gb.set_of_books_id='1001'
       AND glcc.segment2='T'
       AND glcc.segment4='T'
       AND glcc.segment5='T'
       AND glcc.segment6='T'
       AND glcc.segment7='T'
       AND length(glcc.segment3)=4
       AND ffv1.flex_value_set_id='1009494'
       AND ffv2.flex_value_set_id='1009495'
       AND ffv3.flex_value_set_id='1009497'
       AND ffv4.flex_value_set_id='1009498'
       AND ffv5.flex_value_set_id='1009499'
       AND ffv6.flex_value_set_id='1009500'
       and glcc.segment1=ffv1.flex_value
       and glcc.segment2=ffv2.flex_value
       and glcc.segment3=ffv3.flex_value
       and glcc.segment4=ffv4.flex_value
       and glcc.segment5=ffv5.flex_value
       and glcc.segment6=ffv6.flex_value
       AND GP.PERIOD_NAME=GB.PERIOD_NAME
      
       and gb.period_name = '2007-02'
       --and glcc.segment3 in ('1009','1101','1111','1121','1123','1131','1143','1201','1211','1301','1421','1711','1801','1902','2103','2147','2149','2202','2211','3000')
       --and glcc.segment1 like '860101%'
       --and glcc.segment3 in ('11220100','16010300','16010400','16020300','16020400','16090100','17010402','17019902','19010100')
       and gb.currency_code='CNY'
       and gb.actual_flag = 'A'
       and gb.begin_balance_dr-gb.begin_balance_cr + gb.period_net_dr-gb.period_net_cr <>'0'
       order by 3
发表于 2007/10/8 16:55:31 | 显示全部楼层

FSG报表行分配查询

select ras.name,rra.axis_seq,rra.description,rac.sign,
rac.segment1_low||'.'||segment2_low||'.'||segment3_low||'.'||segment4_low||'.'||segment5_low||'.'||segment6_low'.'||segment7_low,
rac.segment1_high||'.'||rac.segment2_high||'.'||rac.segment3_high||'.'||rac.segment4_high||'.'||rac.segment5_high||'.'||rac.segment6_high'.'||rac.segment7_high,
rac.segment1_type||'.'||rac.segment2_type||'.'||rac.segment3_type||'.'||rac.segment4_type||'.'||rac.segment5_type||'.'||rac.segment6_type
from RG_REPORT_AXIS_SETS ras,
     rg_report_axes rra,
     RG_REPORT_AXIS_CONTENTS rac
where ras.axis_set_id=rra.axis_set_id
and rra.axis_seq=rac.axis_seq
and ras.axis_set_id=rac.axis_set_id
and ras.name='07_预算执行汇总表行集'
--AND rra.description like '4431%'
order by rra.axis_seq
发表于 2007/10/10 09:43:28 | 显示全部楼层
楼主很伟大。。。。
发表于 2007/10/10 09:43:58 | 显示全部楼层
这年头无私奉献的人真的越来越少了
发表于 2007/10/11 08:48:49 | 显示全部楼层
very good :victory: :victory:
发表于 2007/10/11 12:06:36 | 显示全部楼层
Thanks.........
发表于 2007/10/11 15:29:56 | 显示全部楼层
Thanks for you share,learnig!
发表于 2007/10/12 17:32:02 | 显示全部楼层

好贴

向前辈学习,致敬!!!
发表于 2007/10/17 13:18:32 | 显示全部楼层
好帖子啊,研究研究
发表于 2007/10/24 11:29:06 | 显示全部楼层
谢谢,以后再来找需要的,呵呵
发表于 2007/10/25 09:57:43 | 显示全部楼层
真好,好宝贝
发表于 2007/10/25 09:59:30 | 显示全部楼层
&gt
&lt

可否请楼主帮我解答一下,这两个参数是怎么使用的,我是刚接触Oracle,谢谢
发表于 2007/10/25 13:28:50 | 显示全部楼层
高手,太厉害了,顶以下,值得好好学习
发表于 2007/11/25 18:25:14 | 显示全部楼层
下载了很多,期待继续~~继续关注此贴~~
发表于 2007/12/4 15:17:34 | 显示全部楼层
好强啊~都是牛人啊~~~~~~~~~~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 03:04 , Processed in 0.025882 second(s), 13 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表