cancel
Showing results for 
Search instead for 
Did you mean: 

Distinct SQL clause with Recordset object

Former Member
0 Kudos

Hi all, I was using a recordset with an sql ‘distinct’ clause, on SAP B1 SP:0

Now we have updated to SP1, and it seems like recordset query doesn’t works well with the ‘distinct’ clause.

It returns all values.

Does anybody tried to use this clause with SP1?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

DISTINCT is not working in SBO recordsets. You try using GROUP BY clause to achive this.

SELECT DISTINCT <Field_Name> FROM [table]

can be achived using

SELECT <Field_Name> FROM [table] GROUP BY <Field_Name>

HTH

With Regards

B.Ravi Shankar

Former Member
0 Kudos

Hi,

The DISTINCT clause by itself is NOT working in recordsets. You have to programatically make sure that you have the distinct records. So, if you're adding distinct records to a combo box you can either check if it exists before you add it or you can add a try... catch block around it that just catches the error (without displaying anything) when you add to a combo box.

Hope it helps,

Adele