当前位置:网站首页>每日的盐 C#生成imei校验位
每日的盐 C#生成imei校验位
2022-08-05 17:53:00 【小黄人软件】
Mysql
--重复sn始终取最后一条
select * FROM production_log WHERE ( sn in('1') or imei1 in('1') or imei2 in('1') ) and dt IN (
select * from (
(SELECT max(dt) FROM production_log WHERE ( sn in('1') or imei1 in('1') or imei2 in('1') ) GROUP BY sn )
b)
) order by sn
--删除地址重复,保留最小id
DELETE FROM file WHERE fileaddress IN (
select * from (
( SELECT fileaddress FROM file GROUP BY fileaddress HAVING count(fileaddress) > 1)
a)
)
AND id NOT IN (
select * from (
(SELECT min(id) FROM file GROUP BY fileaddress HAVING count(fileaddress) > 1 )
b)
)
找出fileaddress重复的地址
找出fileaddress重复的地址 且不删除最小id
#看看还有没有重复的
select * from production_log where dt>'2022-07-25' group by sn having (count(sn)>1)Mysql实现导入生产数据
想用sql脚本直接导入,发现低版本5.5.38对事务仅支持sql语句 使while for支持不好。
还是用C#吧。
//生成imei校验位
public static char GetIMEICheckDigit(string imei)
{
int i;
int sum1 = 0, sum2 = 0, total = 0;
int temp = 0;
for (i = 0; i < 14; i++)
{
if ((i % 2) == 0)
{
sum1 = sum1 + imei[i] - '0';
}
else
{
temp = (imei[i] - '0') * 2;
if (temp < 10)
{
sum2 = sum2 + temp;
}
else
{
sum2 = sum2 + 1 + temp - 10;
}
}
}
total = sum1 + sum2;
if ((total % 10) == 0)
{
return '0';
}
else
{
return (char)(((total / 10) * 10) + 10 - total + '0');
}
}边栏推荐
- LeetCode·每日一题·623.在二叉树中增加一行·递归·迭代
- SwiftUI 教程之使用 DocumentGroup 和 FileDocument 创建基于文本文档的应用程序
- 点击 Fiori Launchpad tile 后报错的处理方法
- 一般来说,农产品期货哪个品种波动最大
- Cow attracts the sword refers to the offer of binary search
- 按钮弹窗事件
- Notes from Google Play | Google Play 持续助力您的应用和游戏
- INPUT
- js实现下拉菜单 人性化体验
- Harbor 2.x API整理:获取指定project下的helm charts列表
猜你喜欢
随机推荐
科研实习 | 北京大学万小军老师课题组招收NLP方向实习生和访问学生
PG 的 statistics 与 extended statistics
【数据挖掘】顺丰公司数据挖掘笔试题
VSCode使用简介
通过软链接mklink共享node_modules
Time-series database selection and implementation practice for Xingsheng optimal monitoring scenarios
Pipenv
Moyck 的 App 库
Photoshop抠图-边缘调整
Kettle需求场景复现
代码签名证书多少钱?
浏览器窗口尺寸相关的 API 整理图
canvas实现多个图片合成js特效
HJ41 称砝码 HJ41 称砝码
leetcode 729. My Calendar I(日程1)
一套多用表单小部件代码下载
培训机构与自学的优缺点都有什么
SwiftUI 教程之使用 DocumentGroup 和 FileDocument 创建基于文本文档的应用程序
点击 Fiori Launchpad tile 后报错的处理方法
阿里云赵明山:详解灵活可插拔的渐进式发布框架OpenKruise Rollout









