Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Return only 1 record in a table

Hi

I have a table that contains employee number and employee name, in some cases the table has 2 records

Eg

Employee no          EmployeeName

20000005               JOE BLOGS

20000005                joe blogs

I need to return just 1 record

1 Solution

Accepted Solutions
sunny_talwar

May be try using FirstValue or LastValue function in the script:

LOAD EmpNO,

          FirstValue(EmpName) as EmpName

Resident YourTable

Group By EmpNo;

View solution in original post

6 Replies
sunny_talwar

May be try using FirstValue or LastValue function in the script:

LOAD EmpNO,

          FirstValue(EmpName) as EmpName

Resident YourTable

Group By EmpNo;

PrashantSangle

Hi,

Then what do you want to do with 2 emplyoee Name

Try concat()

try like

Load EmployeeNo,

Concat(EmployeeName) as CombineEmployeeName

From TableName;

Kind Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Kushal_Chawda

Try like this if you have more fields in table add remaining field in group by

Data:

load Empno

         Firstvalue(Empname) as Empname

Group by Empno;

load Empno,

         Capitalize(Trim(Empname)) as Empname

From Table;

ThornOfCrowns
Specialist II
Specialist II

Which one of those two records is 'correct'?

avinashelite

As per you data sample , due to the case miss match its showing as two different records try to convert then to common format using Capitalize() or Upper () function will do that

LOAD [Employee no],

Capitalize([EmployeeName]) as EmployeeName,

//Upper(EmployeeName) as EmployeeName

sunny_talwar

Good to question to ask