TERA DATA SQL Count Statement in a subquery ..

General

TERA DATA SQL Count Statement in a subquery ..

Hi,

I have the following SQL query for this I need to find a count of the rows

SELECT COL1,COL2,COL3

FROM SCHEMA.TABLE1

WHERE COL1 IN ('A','B') AND COL2 IN (SELECT COL2 FROM SCHEMA.TABLE2)

Tags (1)
1 REPLY

Re: TERA DATA SQL Count Statement in a subquery ..


Overall Count:

SELECT  COUNT(*)

FROM SCHEMA.TABLE1

WHERE COL1 IN ('A','B') 

AND COL2 IN (SELECT COL2 FROM SCHEMA.TABLE2);

Columnwise Count:

SELECT COL1,COL2,COL3,COUNT(*)

FROM SCHEMA.TABLE1

WHERE COL1 IN ('A','B') AND COL2 IN (SELECT COL2 FROM SCHEMA.TABLE2)

GROUP BY 1,2,3;