How can i SELECT DISTINCT IN X++ select statment

hi guyz in sql its possible to use SELECT DISTINCT in cases where a table has duplicate value

how can i achieve this in X++ select statement

U can use ‘like’ keyword to find the duplicates.

Ex:-

select contactPerson
where contactPerson.(whereFieldId) == this.AccountNum
&& contactPerson.Name like _name;

Hi Kimmi,

Use ‘GroupBy’ in the select statement which field you want the distinct records.

Naresh Kolli

i just want to select one record distinctively out of the duplicates.

assume i have a table with customer transactions i want to select distinctively all customer that have transactions in that tables

without duplication. just the way the sql statement SELECT DISTINCT works

naresh

thanks that works perfectly!

Hi Kamini

An Naresh said you can use Group By;

while select count(recId) from rentalTable

group by rentalTable.CustAccount

{

info(strfmt(" Customer %1 has rented cars %2 times", rentalTable.CustAccount, rentalTable.RecId));

}