From September 2006 to January 2009, my college life came close to graduation. From March 2009 to December 2014, I ended the work gap as an employee of an IC card, from January 2015--now, in the section of the unemployed training room.
IC Card Initialization Although programmed, boring annoying taste. But the database is also intriguing. Now excerpt out, let that period of time dust-laden.
The initial program of IC card is: a VB program (input program); two databases (a SQL2005, as an initialization library, a check library; a MySQL, as a benchmark library).
Now some of the commonly used statements, copy down:
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 for inner code, KAOHAO1 for Outer Wharf;
2.[ZK] for the first letter of the General library of Hanyu Pinyin;
3.[zgsku] for the head office Library of Hanyu Pinyin abbreviation;
4.order by for sorting;
5. DESC is a descending abbreviation of English;
6. LRRQ is an abbreviation for the date of entry of Hanyu Pinyin;)
What does the A\ b mean????
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
Remove Bad cards:
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 ')
--(the Order of NECA and outer card cannot be reversed, the inner code is in front, the outside code is behind)
Select Kahao1,kahao from [ZK]. [dbo]. [Zgsku] where kahao1 in (
' 00985289 ', ' 00981928 ', ' 00985211 ', ' 00982295 ', ' 00985319 ') Order BY kahao1 Desc
--Machine to make tickets
--check record of recording card
--select Count (*) from [ZK]. [dbo]. [Zgsku] where lrrq between ' 2013-01-01 ' and ' 2013-09-09 '
Pour out the whole box card:
Select ' INSERT into IC_BASIC_INFO_JM values (' ' +a.kahao1+ ' ', ' ' +a.kahao+ ', NULL, ' normal ', ' retract ', ' Programmer ', ' +A.LRRQ + ", null,null); ' As S
from [ZK]. [dbo]. [Zgsku] A where a.kahao1 >= ' 01302001 ' and a.kahao1 <= ' 01303000 ' ORDER by Lrrq Desc
Comments
1.select insertion;
2. ' INSERT into IC_BASIC_INFO_JM values
(' +a.kahao1+ ', ' +a.kahao+ ', null, ' normal ', ' retract ' ', ' ' Programmer ' ', ' ' +a.lrrq+ ', null, NULL); '
Embedded content
3.insert into IC_CARD_INFOR_JM Insert Table IC_CARD_JM (table in MySQL database);
4. (' +a.kahao1+ ', ' +a.kahao+ ', null, ' normal ', ' retract ', ' ' Programmer ' ', ' ' +a.lrrq+ ', null, null ')
"' +a.kahao1+ ' corresponds to the ic_card_no in MYDQL; +a.kahao+ ' ' corresponds to the ic_card_inner_no in MySQL;
Null corresponds to Business_station; ' Normal ' corresponds to status; ' Take back the ' corresponding dispath_status; ' Programmer ' corresponds to operator;
"' +a.lrrq+ ' corresponds to update_date;null corresponding to Area_code; Null corresponds to dev_id;)
5.aS s name the above as S;
6.from [ZK]. [dbo]. [Zgsku] A from the table [ZK]. [dbo]. [Zgsku] A;
7.where (a.kahao1 >= ' 01269001 ' and a.kahao1 <= ' 01270000 ') restriction conditions;
8.order by Lrrq Desc LRRQ the order of precedence;)
Scattered card query:
Select ' INSERT into IC_BASIC_INFO_JM values (' ' +a.kahao1+ ' ', ' ' +a.kahao+ ', NULL, ' normal ', ' retract ', ' Programmer ', ' +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
Five years of Time