sql查询作业-保单涉及表的复杂查询

生气1. 根据一个保单号grpcontno  查询出 投保单位的地址信息, 省,市 县 详细地址
select province||city||country||grpaddress from lcgrpaddress la  inner join lcgrpappnt lc  on la.customerno = lc.customerno and la.addressno = lc.addressno where grpcontno='GA01019900000212'

得意2. 根据一个保单号 查询出 保单下有那些计划, 计划编码, 计划名称
select contplancode ,contplanname  from lccontplan where grpcontno='GA01019900000212'

惊讶3。 根据一个 人的名称, 人的idno  查询出 这个人 是那些保单的被保人,
select grpcontno  from lccont   where insuredname='一号被保人'and  lccont.insuredIdno='123456'

 
安静4、 根据 一个保单号 一个人的 name,idno ,  查询出 这个人有哪些险种, 每个险种的保费是多少。
select lm.riskname ,lp.prem  from lccont lc inner join lcpol lp on lp.contno = lc.contno  inner join lmriskapp lm on lm.riskcode=lp.riskcode
where lp.grpcontno='GA01019900000212'and lc.insuredname='一号被保人' and lc.insuredIdno='123456'

偷笑5、  根据 一个保单号 一个人的 name,idno ,  查询出 这个人有哪些责任, 每个责任的保费是多少。
select dutyname  ,lc.prem  from lccont la inner join lcpol lb on la.contno=lb.contno inner join lcduty lc on  lb.polno=lc.polno inner join lmduty ld on ld.dutycode=lc.dutycode
where lb.grpcontno='GA01019900000212' and la.insuredname='一号被保人' and la.insuredIdno='123456'

可怜6、  根据一个保单号, 查询出 总共有多少被保人,  共有多少保费
select count(countno),sum(prem) from lccont where grpcontno='GA01019900000212'

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值