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

Can someone please help?

I have the following script which joins a couple of tables by UniqueKey, what I now want to do is create an additional field based on the newly created table. I can get it to work but the data is growing when I don't believe is should be, can anyone suggest what I'm doing wrong...or maybe a better way of doing it?

AWDCombined:

LOAD UniqueKey,

     SchemeNo

FROM [Combined.qvd]

Left Join (AWDCombined)

LOAD UniqueKey,

     NGSSchemeNo;

SQL SELECT *

FROM FPWFI;

Left Join (AWDCombined)

LOAD UniqueKey,

     if(Len(SchemeNo)>6,NGSSchemeNo,SchemeNo) as RealSchemeNo

Resident AWDCombined;

Like I say, the above does work, it just seems to cause the underlying data to grow and I don't know why.

3 Replies
manideep78
Partner - Specialist
Partner - Specialist

Tryt this,

AWDCombined:

LOAD *, if(Len(SchemeNo)>6,NGSSchemeNo,SchemeNo) as RealSchemeNo;

LOAD UniqueKey,

     SchemeNo

FROM [Combined.qvd]

Left Join (AWDCombined)

LOAD UniqueKey,

     NGSSchemeNo;

SQL SELECT *

FROM FPWFI;

maxgro
MVP
MVP

the data grow? is the UniqueKey really unique (in qvd and in db)?

preminqlik
Specialist II
Specialist II

try this  : use distinct

AWDCombined:

LOAD distinct UniqueKey,

     SchemeNo

FROM [Combined.qvd]

Left Join (AWDCombined)

LOAD distinct UniqueKey,

     NGSSchemeNo;

SQL SELECT *

FROM FPWFI;

Left Join (AWDCombined)

LOAD distinct UniqueKey,

     if(Len(SchemeNo)>6,NGSSchemeNo,SchemeNo) as RealSchemeNo

Resident AWDCombined;