Need to calculate count of first name and last name based on Individual Names

Database

Need to calculate count of first name and last name based on Individual Names

Hi All,

I am new to teradata . I have query that i need to count INDV_NAME_COUNT based on logic below.

If Firstname and Last name is present then INDV_NAME_CT will be 2

If Firstname or Last Name is present ( means one of them present) then count should be 1

If neither present the count should be 0.

How to implement this in Teradata. we have 3 columns in table INDV_FRST_NM, INDV_LST_NM , and INDV_NAME_CT.

Thanks

Vivek

1 REPLY
Junior Contributor

Re: Need to calculate count of first name and last name based on Individual Names

CASE WHEN INDV_FRST_NM IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN INDV_LST_NM IS NOT NULL THEN 1 ELSE 0 END