arajasek
8th August 2002, 12:27
Hi,
I was trying to get distinct records from main table in a display session. And so Iwas tryin it out in a query extension. Problem is I could get the required records, But Iam not able to skip the duplicate records.

Let me explain this with an example. Lets assume that we have 2 tables Emp and dept.

Here is the structure of the tables ...

Emp table --> Enum, Ename, Esal
Dept table --> Dnum, Dname

So this way I have 100 records in employee table and just 4 records in dept table which means we just have 4 departments. Now my problem is to fetch just 4 records from employee table thru a query extension on Emp table... since main table for this dsiplay session is employee table.

I hope I was clear in explainin the situation.

Kindly help me out to solve this problem.

~Vamsi
8th August 2002, 13:43
Is dnum a field in the Emp table? If it is then multiple employees can belong to each of the departments. So which four employees do you want to show on the display session? Post the query extension for us to understand a little better.

mast_aadmi
22nd August 2010, 14:25
I have a similar problem. I'm working with the table tccom100 as my main table.
Now i want to view only those business partners who have an entry in the table tdpur400. But the problem is that there are multiple records in the table tdpur400 with a single business partner and i'm not able to use the query.extend to return distinct records. As a result i have duplicate Business partner records. Is there any way to solve this.

rp.chowdary
23rd August 2010, 09:30
select your reqiure data using query.extend.select, query.extend.from and query.extend.where functions and then use rebuild.query().

this may help for you.

sameer.don
23rd August 2010, 12:07
I have a similar problem. I'm working with the table tccom100 as my main table.
Now i want to view only those business partners who have an entry in the table tdpur400. But the problem is that there are multiple records in the table tdpur400 with a single business partner and i'm not able to use the query.extend to return distinct records. As a result i have duplicate Business partner records. Is there any way to solve this.



You can have code in before.display.object or main.table.io section, where u can write a query on tdpur400 with set specification to select just one record.
and then if record not found u can skip current read on the main table.

Or
u can use IN clause with query.extension
for eg:
query.extension = " where tccom100.bpid in (select tdpur400.bpid from tdpur400 where tdpur400.otbp = :tccom100.bpid as set with 1 rows) "

mast_aadmi
25th August 2010, 08:24
Thanks Sameer. I wasn't thinking on the lines of using the IN command. Thanks for the solution.