I am new to teradata and I have to convert SAS code to teradata. The SAS code goes like this
if first.CRD_ACCT_NBR then do ;
if PRIM_CRD_IND = 'S' then nbsup=sum(nbsup,1,0);
if last.CRD_ACCT_NBR then output ;
I need to set value for nbsup as 0 when i have the first instance of CRD_ACC_NBR.
Please help me to convert this into teradata SQL.
From what little I know of SAS language, the SQL equivalent (in any database, not just Teradata) would be:
select count(*) from <table-name> group by CRD_ACCT_NBR where PRIM_CRD_IND = 'S'