1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
SELECT
ABONNE.IDABONNE [ABONNE.IDABONNE],
ABONNE.IDCLIENT [ABONNE.IDCLIENT],
ABONNE.IDSERVICE [ABONNE.IDSERVICE],
ABONNE.GUID [ABONNE.GUID],
ABONNE.IDPREFIX [ABONNE.IDPREFIX],
ABONNE.IDSHORTSNO [ABONNE.IDSHORTSNO],
ABONNE.IDMEDIACODE [ABONNE.IDMEDIACODE],
ABONNE.SNO [ABONNE.SNO],
ABONNE.TRANSID [ABONNE.TRANSID],
ABONNE.LINKEDID [ABONNE.LINKEDID],
ABONNE.OPERATORCLIENTID [ABONNE.OPERATORCLIENTID],
ABONNE.UNSUBSCRIPTIONREQUESTED [ABONNE.UNSUBSCRIPTIONREQUESTED],
ABONNE.IDSMSUNSUBSCRIPTION [ABONNE.IDSMSUNSUBSCRIPTION],
ABONNE.ORGPREFIX [ABONNE.ORGPREFIX],
ABONNE.REMINDERDATETIME [ABONNE.REMINDERDATETIME],
ABONNE.RENEWDATETIME [ABONNE.RENEWDATETIME],
ABONNE.SENDPERIODICCONTENTDATETIME [ABONNE.SENDPERIODICCONTENTDATETIME],
ABONNE.EXPIREDDATETIME [ABONNE.EXPIREDDATETIME],
ABONNE.UNSUBSCRIBABLEDATETIME [ABONNE.UNSUBSCRIBABLEDATETIME],
ABONNE.UNSUBSCRIPTIONDATETIME [ABONNE.UNSUBSCRIPTIONDATETIME],
ABONNE.LIMITOVERCEILINGDATETIME [ABONNE.LIMITOVERCEILINGDATETIME],
ABONNE.LASTBILLEDDATETIME [ABONNE.LASTBILLEDDATETIME],
ABONNE.CREATEDDATETIME [ABONNE.CREATEDDATETIME],
ABONNE.UPDATEDDATETIME [ABONNE.UPDATEDDATETIME],
ABONNE.IDEMPLOYEE [ABONNE.IDEMPLOYEE],
ABONNE.IDABONNESTATUS [ABONNE.IDABONNESTATUS],
ABONNE.SCORE [ABONNE.SCORE],
ABONNE.SEQUENCE [ABONNE.SEQUENCE],
ABONNE.GENDER [ABONNE.GENDER],
ABONNE.AGE [ABONNE.AGE],
ABONNE.TOWN [ABONNE.TOWN],
ABONNE.PSEUDO [ABONNE.PSEUDO],
CLIENT.MSN [CLIENT.MSN],
CLIENT.IDCLIENTSTATUS [CLIENT.IDCLIENTSTATUS],
CLIENT.DESCRIPTION [CLIENT.DESCRIPTION],
CLIENT.CREATEDDATETIME [CLIENT.CREATEDDATETIME],
CLIENT.UPDATEDDATETIME [CLIENT.UPDATEDDATETIME],
CLIENT.IDOPERATOR [CLIENT.IDOPERATOR],
CLIENT.IDNETWORK [CLIENT.IDNETWORK],
CLIENT.IDGATEWAY [CLIENT.IDGATEWAY],
CLIENT.IDEMPLOYEE [CLIENT.IDEMPLOYEE]
FROM dbo.ABONNE
INNER JOIN dbo.CLIENT ON ABONNE.IDCLIENT = CLIENT.IDCLIENT
WHERE ABONNE.IDABONNESTATUS = 1
AND ABONNE.REMINDERDATETIME < GETDATE()
AND (ABONNE.LIMITOVERCEILINGDATETIME < GETDATE() OR ABONNE.LIMITOVERCEILINGDATETIME IS NULL)
AND IDSERVICE NOT IN (SELECT IDSERVICE FROM dbo.SMSSERVICE WHERE MINUTESOFREMINDER = 0 OR MINUTESOFREMINDER IS NULL OR ISACTIVE = 0 )
AND IDSERVICE IN (SELECT IDSERVICE FROM dbo.SMSSERVICE WHERE (IDSERVICETYPE IN (2,5,7,8) AND IDCOMPANY = 2)) |
Partager