Created
January 15, 2021 16:03
-
-
Save motaher13/6036f5e1edad8ec749a3a5214342560d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE vbSMSContactTest ( | |
cntContactNo varchar(50) NOT NULL, | |
cntSMSCountryID decimal(18,0) NOT NULL, | |
cntCountryCode varchar(10) NOT NULL, | |
cntOperatorCode varchar(10) NOT NULL, | |
cntSource varchar(100) DEFAULT NULL, | |
cntStatus tinyint(4) DEFAULT NULL, | |
cntCreationDate bigint(20) NOT NULL | |
); | |
ALTER TABLE vbSMSContactTest | |
ADD PRIMARY KEY (cntContactNo); | |
CREATE INDEX index_contact | |
ON vbSMSContactTest(cntCountryCode,cntOperatorCode); | |
INSERT INTO vbSMSContactTest (cntContactNo, cntSMSCountryID,cntCountryCode, cntOperatorCode, cntSource, cntStatus, cntCreationDate) | |
SELECT n, 100, "880", "17", "btrc", 1, 1234 | |
FROM | |
( | |
select a.N + b.N * 10 + c.N * 100 + d.N * 1000 + e.N * 10000 + f.N * 100000 + 1 N | |
from (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) a | |
, (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) b | |
, (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) c | |
, (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) d | |
, (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) e | |
, (select 0 as N union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) f | |
order by n | |
) t | |
SELECT COUNT(cntContactNo), cntCountryCode, cntOperatorCode FROM vbSMSContactTest GROUP BY cntCountryCode, cntOperatorCode | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment