• 五年的时光


          从2006年09月--2009年1月,我的大学生活走近了毕业。从2009年03月--2014年12月,我作为一名IC卡初始化的员工结束了工作间隙性结束;从2015年01月--现在,处于待业培训间段。

          IC 卡初始化虽然程序化,枯燥烦味。可其中的数据库也是耐人寻味。现摘录出来,让那段时间尘封。

      IC卡的初始程序为:一个VB程序(录入程序);两个数据库(一个SQL2005,作为初始化库、检查库;一个Mysql,作为基准库)。

      现将一些常用的语句,COPY下来:

      

       
    SELECT
      a.kahao,a.kahao1,'1'
      FROM [zk].[dbo].[zgsku] a,
      (select kahao1,max(lrrq) lr from [zk].[dbo].[zgsku] group by kahao1) b
    where  a.kahao1=b.kahao1 and a.lrrq=b.lr
    and (a.kahao1 >='00664401'and  a.kahao1 <='00666400')

    order by lrrq asc


         1.kahao为内码,kaohao1为外码头;
         2.[ZK]为总库的汉语拼音的首字母;
         3.[zgsku]为总公司库的汉语拼音缩写;
         4.order by 为排序;
         5. desc 为降序的英文缩写;
         6. lrrq 为录入日期的汉语拼音的缩写;)

    其中的a b 是什么意思????

    SELECT
     a.kahao, a.kahao1,'1'
     FROM [zk].[dbo].[zgsku] a,
     (SELECT
      kahao1, max(lrrq) lr
      FROM [ZK].[DBO].[zgsku]
         group by kahao1) b
     where a.kahao1=b.kahao1 and a.lrrq=b.lr
     and (a.kahao1>='00664401' and a.kahao1<='00666400')
     order by Lrrq asc


    删除坏卡:

    delete from [zk].[dbo].[zgsku] where kahao='12f4b372'


    select from [zk].[dbo].[zgsku]
    where kahao = '6d942891'


    SELECT
      a.kahao,a.kahao1,'1'
      FROM [zk].[dbo].[zgsku] a,
      (select kahao1,max(lrrq) lr from [zk].[dbo].[zgsku] group by kahao1) b
    where  a.kahao1=b.kahao1 and a.lrrq=b.lr
    and (a.kahao1 in
    ('00523831','00523862'
    ))
    order by lrrq desc


    SELECT
      a.kahao,a.kahao1,'1'
      FROM [zk].[dbo].[zgsku] a,
      (select kahao1,max(lrrq) lr from [zk].[dbo].[zgsku] group by kahao1) b
    where  a.kahao1=b.kahao1 and a.lrrq=b.lr
    and (a.kahao in
    ('00964608','00841429'))
    --and lrrq>='2010-08-11'
    order by lrrq desc

    delete from [zk].[dbo].[zgsku] where kahao in ('0bd56771')


    --(内卡号和外卡号的顺序不能颠倒,内码在前,外码在后)

    select kahao1,kahao from [zk].[dbo].[zgsku] where kahao1 in (
     '00985289','00981928','00985211','00982295','00985319')order by kahao1 desc

    --机打票

    --查询录卡记录

    --select count(*) FROM [zk].[dbo].[zgsku] where lrrq between'2013-01-01'and '2013-09-09'

    整盒卡倒入倒出:


    select 'insert into ic_basic_info_jm values ('''+a.kahao1+''','''+a.kahao+''',NULL,''正常'',''收回'',''程序员'','''+a.lrrq+''',null,null);' as s
    from [zk].[dbo].[zgsku] a where a.kahao1 >='01302001'and  a.kahao1 <='01303000' order by lrrq desc

    (注释:
      1.select 插入;
      2.'insert into ic_basic_info_jm values

    ( '''+a.kahao1+''', '''+a.kahao+''', NULL, ''正常'', ''收回'', ''程序员'', '''+a.lrrq+''', null, null);'
      嵌入式内容
      3.insert into ic_card_infor_jm 插入表ic_card_jm(mysql数据库中的张表);
      4.( '''+a.kahao1+''', '''+a.kahao+''', NULL, ''正常'', ''收回'', ''程序员'', '''+a.lrrq+''', null, null)
         '''+a.kahao1+'''对应mydql中的ic_Card_no;'''+a.kahao+'''对应mysql中的ic_Card_inner_no;
        null对应business_station; ''正常''对应status;''收回''对应dispath_status; ''程序员''对应operator;
        '''+a.lrrq+'''对应Update_date;null对应area_code; null对应 dev_id;)
     5.aS s 将以上命名为s; 
     6.from [zk].[dbo].[zgsku] a 来自表[zk].[dbo].[zgsku] a;
     7.where (a.kahao1 >='01269001'and  a.kahao1 <='01270000')限制条件;
     8.order by lrrq desc lrrq的先后排序;)

    零散卡查询:


    select 'insert into ic_basic_info_jm values ('''+a.kahao1+''','''+a.kahao+''',NULL,''正常'',''收回'',''程序员'','''+a.lrrq+''',null,null);' as s
    from [zk].[dbo].[zgsku] a where a.kahao1 in ('01250100','01237991','01194611','01159788','01192434',
    '01192451','01192570','01221468','01194651','01168371',
    '01178321','01226527','01300632','01300633','01300634') order by lrrq  desc

    The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. Albert Einstein, What I Believe, 1930!
  • 相关阅读:
    sed思维导图
    Golang计算文件MD5
    grpc入门
    解决使用fastjson时,null值在转JSONObject时丢失的问题
    ArcGIS空间分析案例教程网格和标记生成
    在 VirtualBox VM 中安装 OpenWRT
    aws中各个系统的用户名
    emacs简单配置和scheme环境
    Vue 中引入 json 的三种方法
    Lodash节流和防抖总结
  • 原文地址:https://www.cnblogs.com/666638zhangqiang/p/4424314.html
Copyright © 2020-2023  润新知