五年的時光

來源:互聯網
上載者:User

標籤:

      從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

五年的時光

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.