Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
kartik
Contributor III
Contributor III

How to make the frequency of key as 1

Hi Everyone,

I've one question. Actually, I have a table in which there are two columns that I need to add to the main table by doing a left join. But the key I made has some row frequency as (2).

Temp:
LOAD
"DLR_NO",
"SVY_RST_NO",
"SVY_TMPL_NO",
"SVY_TYPE",
"SVY_NO",
DATE(DATE#("SVY_DATE",'YYYYMMDD'),'DD/MM/YYYY') AS Svy_date,
ROUND(("SVY_FINAL_SCORE") /7) AS Final_Score,
"SVY_EQRY_NO";
SQL SELECT "DLR_NO",
"SVY_RST_NO",
"SVY_TMPL_NO",
"SVY_TYPE",
"SVY_NO",
"SVY_DATE",
"SVY_FINAL_SCORE",
"SVY_EQRY_NO"
FROM DMSDBA."CRM_SVYCST_TB";

FEEDBACK:
load *,
"DLR_NO" & '|' & "SVY_EQRY_NO" AS key

RESIDENT Temp

WHERE "SVY_TYPE"='27'
AND "SVY_TMPL_NO"='51'
AND "SVY_NO"='SV20210902'
;
DROP TABLE Temp;

EXIT SCRIPT;

and here is the output which I need to fix to get the correct data.

kartik_1-1647853129401.png

 

How can I make this frequency a single 1? I can't use any other columns to make the key as in the main table, only dlr no. and enquiry no is present.

Labels (4)
4 Replies
Chanty4u
MVP
MVP

Hi 

 

but do you have duplicates in your key columns?

and one more reason could be..  the other fields related values are two for those key fields.

And try to remove one one field to check which field is having two count aswell. so that you will come to know.

kartik
Contributor III
Contributor III
Author

kartik_0-1647857267330.png

distinct function is not working in this and it's not duplicated because it is making a unique key with RST_no Column. And the business requirement is that it should show 1 result for particular key. 

Chanty4u
MVP
MVP

try to do other steps which i mentioned above

Anil_Babu_Samineni

What is the output you expecting for?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful