How to compare bteq select count ?

Tools

How to compare bteq select count ?

How to compare 2 SQL Count in Bteq ?

SELECT COUNT(*) FROM ATable HAVING COUNT(*) >= SELECT COUNT(*) FROM BTable HAVING COUNT(*)
.IF ERRORCODE <> 0 THEN .QUIT 10;

.IF ACTIVITYCOUNT = 1 THEN .GOTO ACT_1;
.IF ACTIVITYCOUNT = 0 THEN .GOTO ACT_2;

.LABEL ACT_1;
action 1 sql;

.LABEL ACT_2;
action 2 sql;
1 REPLY
Teradata Employee

Re: How to compare bteq select count ?

Hello,

May be you can try it with COUNT(*) OVER(), otherwise you can try following:

SELECT * FROM
(
SELECT COUNT(*) a FROM table1
) a
,
(
SELECT COUNT(*) b FROM table2
) b

HTH.

Regards,

Adeel