mysql exist运用
来源:互联网 发布:ios防骚扰软件 编辑:程序博客网 时间:2024/06/11 12:37
-- 后台的
select a.province_id,b.name from tbl_withhold_province_station a,tbl_province b where a.province_id = b.id;
-- 已签约的省份列表
select distinct(a.province_id),b.province_name from tbl_vehicle_withhold_agreement a,tbl_withhold_province_station b where a.province_id = b.province_id
and vehicle_lic = '京A12345';
-- 已签约的方案二
select province_id,`province_name` from tbl_withhold_province_station a where exists (select province_id from tbl_vehicle_withhold_agreement
b where a.province_id = b.province_id)
-- 是否可以添加代扣范围
-- 方案一
select count(distinct(a.province_id)) as sign_pro_count from tbl_vehicle_withhold_agreement a,tbl_withhold_province_station b where a.province_id = b.province_id
and vehicle_lic = '京A12345';
select count(distinct(province_id)) as all_pro_count from tbl_withhold_province_station;
-- 方案二
select province_id from tbl_withhold_province_station where province_id in (select GROUP_CONCAT(distinct(province_id)) from tbl_vehicle_withhold_agreement
);
select * from tbl_withhold_province_station a where exists (select province_id from tbl_vehicle_withhold_agreement
b where a.province_id = b.province_id);
select province_id,province_name from tbl_withhold_province_station a where not exists (select province_id from tbl_vehicle_withhold_agreement
b where a.province_id = b.province_id and vehicle_lic = '京A12347');
阅读全文
0 0
- mysql exist运用
- Mysql中exist查询
- MySQL运用
- Mysql table '' doesn`t exist
- mysql in和exist比较
- MYSQL FUNCTION mysql.redis_servers_set_v2 does not exist
- Mysql “Table 'mysql.servers' doesn't exist”
- Navicat mysql 'mysql.proc' doesn't exist
- mysql sql_log_bin运用实例
- mysql TIMESTAMP 运用
- MySQL Alter语句 运用 .
- mysql中游标的运用
- linux中的mysql运用
- 数据库备份 Mysql table '' doesn`t exist
- MySQL ('root'@'%') does not exist的问题
- MySQL ('root'@'%') does not exist的问题
- MySQL ('root'@'%') does not exist 的问题
- MySQL ('root'@'%') does not exist的问题
- iOS-GCD定时器
- 无法识别的属性“targetFramework”解决办法
- eclipse 通过Hibernate 逆向生成实体类和映射文件
- 暑期C++03 之浅拷贝问题抛出与解决
- WindowManger与window之详解篇
- mysql exist运用
- 蓝桥杯 ADV-127 算法提高 日期计算
- 关于JavaScript中apply与call的用法意义及区别(转)
- Linux(Ubuntu)怎样设置鼠标速度(灵敏度)
- unity ShaderForge 移动端与PC端表现不同
- 蓝桥杯 ADV-112 算法提高 c++_ch02_01
- 使用Dagger2前你必须了解的一些设计原则
- 关于Deepin下的一些常用软件的安装及环境配置/py/mongodb
- Confluence5.8.10安装和破解