当前位置:网站首页>Daily sql-seek the sum of successful investments in 2016
Daily sql-seek the sum of successful investments in 2016
2022-08-11 07:13:00 【Eating too much sugar will not gain weight】
Daily sql-find the sum of successful investments in 2016
Background
Conditions for successful investment in 2016:
1. The insured amount in 2015 is at least the same as the amount insured by another insured in 2015
2. The coordinates of this insured must be unique.
DDL
CREATE TABLE IF NOT EXISTS insurance (PID INTEGER(11), TIV_2015 NUMERIC(15,2), TIV_2016 NUMERIC(15,2), LAT NUMERIC(5,2), LON NUMERIC(5,2span>) );insert into insurance (PID, TIV_2015, TIV_2016, LAT, LON) values (1, 10, 5, 10, 10);insert into insurance (PID, TIV_2015, TIV_2016, LAT, LON) values (2, 20,20, 20, 20);insert into insurance (PID, TIV_2015, TIV_2016, LAT, LON) values (3, 10, 30, 20, 20span>);insert into insurance (PID, TIV_2015, TIV_2016, LAT, LON) values (4,10, 40, 40, 40); 
sql

SELECT SUM(insurance.TIV_2016) AS TIV_2016FROM insuranceWHERE insurance.TIV_2015 IN( SELECT TIV_2015 FROM insurance GROUP BY TIV_2015 HAVING COUNT(*) > 1 )AND CONCAT(LAT, LON) IN( SELECT CONCAT(LAT, LON) FROM insurance GROUP BY LAT , LON HAVING COUNT(*) = 1 );边栏推荐
猜你喜欢
随机推荐
防火墙-0-管理地址
lvm multi-disk mount, combined use
空间点模式方法_一阶效应和二阶效应
OA项目之我的审批(查询&会议签字)
【LeetCode】851.喧闹与富有(思路+题解)
淘宝sku API 接口(PHP示例)
每日sql:求好友申请通过率
HCIP OSPF dynamic routing protocol
torch.cat()用法
arcgis填坑_3
矩阵分析——Jordan标准形
Windos10专业版开启远程桌面协助
推荐一个好用的IDEA插件---Translation—中英互译
uboot sets the default bootdelay
Map Reduce
从mask-rcnn到shp
OA项目之我的会议(会议排座&送审)
HCIP-生成树(802.1D ,标准生成树/802.1W : RSTP 快速生成树/802.1S : MST 多生成树)
SECURITY DAY04 (Prometheus server, Prometheus monitored terminal, Grafana, monitoring database)
求过去半年内连续30天以上每天都有1000元以上成交的商铺









