I am trying to check if the count output for the below statement (include multiple counts and each one should be with different value) is more than specific value, for example count of SC must be over 20 and count for FC must be over 40 and ASR is less than .3, and if the values is not like mentioned result should be NULL.
Select (select Count() from CDR_Accounts where i_customer like "5434" and i_dest in (select i_dest from Destinations where iso_3166_1_a2 like "PK") and connect_time >= SUBTIME(SYSDATE(),"00:59:59")) AS SC, (select Count() from CDR_Accounts_Failed where i_customer like "5434" and i_dest in (select i_dest from Destinations where iso_3166_1_a2 like "PK") and connect_time >= SUBTIME(SYSDATE(),"00:59:59")) AS FC, ((select Count() from CDR_Accounts where i_customer like "5434" and i_dest in (select i_dest from Destinations where iso_3166_1_a2 like "PK") and connect_time >= SUBTIME(SYSDATE(),"00:59:59"))/((select Count() from CDR_Accounts_Failed where i_customer like "5434" and i_dest in (select i_dest from Destinations where iso_3166_1_a2 like "PK") and connect_time >= SUBTIME(SYSDATE(),"00:59:59"))+(select Count(*) from CDR_Accounts where i_customer like "5434" and i_dest in (select i_dest from Destinations where iso_3166_1_a2 like "PK")and connect_time >= SUBTIME(SYSDATE(),"00:59:59")))) AS ASR;
the result for the above is as below (but changes between now and then)
+------+------+--------+
| SC | FC | ASR |
+------+------+--------+
| 1 | 1 | 0.5000 |
+------+------+--------+
1 row in set (1 min 33.46 sec)
so in this case select should return nothing
appreciate your support in advance
regards
Aucun commentaire:
Enregistrer un commentaire