You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/word/新协航_设计文档/过程性笔记/通过国家代码,获取HS代码及税率.sql

35 lines
1.2 KiB
MySQL

3 years ago
select * from code_country
select * from import_cargo
select * from import_main
select m.contractno,ca.id,c.country,
(select EnumValueName from tSysEnumValue where LangId=0
and EnumTypeID=9000 and EnumValueID=c.tariff) as tariff,
case c.tariff when 0 then ci.tax_zhg when 1 then ci.tax_pt end tax,
ci.tax_zz
from import_cargo ca
left join import_main m on m.contractno=ca.contractno
left join code_country c on m.countryid=c.countryid
left join import_cargoinfo ci on ci.id=ca.cargoinfo_id
select c.country,
(select EnumValueName from tSysEnumValue where LangId=0
and EnumTypeID=9000 and EnumValueID=c.tariff) as tariff,
case c.tariff when 0 then ci.tax_zhg when 1 then ci.tax_pt/100 end tax,
ci.tax_zz/100 tax_zz
from import_cargoinfo ci
left join import_main m on m.contractno=ca.contractno
left join code_country c on m.countryid=c.countryid
where countryid in('GB','ES')
select ci.id,name,code+'_'+name codeandname,
(select EnumValueName from tSysEnumValue where LangId=0
and EnumTypeID=9000 and EnumValueID=cc.tariff) as tariff,
case cc.tariff when 0 then ci.tax_zhg/100 when 1 then ci.tax_pt/100 end tax,
ci.tax_zz/100 as tax_zz from code_country cc,import_cargoinfo ci
where
--countryid in('GB','ES') and
code='0201300090'
select * from code_currency