Friday, 21 April 2017

Tax Codes Tables Joining

http://aporaclepayables.blogspot.com/2017/04/tax-codes-tables-joining.html

select b.NAME Group_Name,
       c.TAX_NAME Tax_code,
       c.TAX_RATE,
       d.ATTRIBUTE5 Section,
       d.ATTRIBUTE3 Tax_Regime,
       d.ATTRIBUTE4 IRIS_TAX_CODES,
       d.ATTRIBUTE6 Exemption_Code_Blank_Space,
       b.DESCRIPTION Group_Description,
       d.DESCRIPTION Tax_name_Description,
       c.START_DATE,
       f.VENDOR_SITE_CODE Site,
       d.ATTRIBUTE1 DFF_SECTION,
       d.ATTRIBUTE2 DFF_DESCRIPTION,
       gc.SEGMENT1 Company,
       gc.SEGMENT2 Location,
       gc.SEGMENT4 Account
  from AP_AWT_GROUP_TAXES_ALL a,
       Ap_Tax_Codes_All       d,
       Ap_Awt_Tax_Rates_All   c,
       AP_AWT_GROUPS          b,
       ap_supplier_sites_all  f,
       gl_code_combinations   gc
 where d.NAME = a.TAX_NAME
   and d.ORG_ID = a.ORG_ID
   and a.TAX_NAME = c.TAX_NAME
   and c.TAX_NAME = d.NAME
   and c.ORG_ID = a.ORG_ID
   and f.VENDOR_SITE_ID = d.AWT_VENDOR_SITE_ID
   and b.GROUP_ID = a.GROUP_ID
   and f.VENDOR_ID = d.AWT_VENDOR_ID
   and gc.CODE_COMBINATION_ID = d.TAX_CODE_COMBINATION_ID
   and c.RATE_TYPE = 'STANDARD'
   and d.ENabLED_FLAG = 'Y'
   and c.END_DATE is null
 order by group_name