Using DISTINCT

I have created a query in AOT joining 3 tables. Now i want that only distinct records should be selected. It should give me the same result as using the DISTINCT keyword in database. Do i have to override any method or write my own method or is there any property available. Quick help will be greatly appreciated from the champions of AXAPTA.

Hi Amit, There is no direct solution in Axapta for this. Try using QueryBuildDataSource’s addSortField method and orderMode property. For more info, please refer to Developer’s guide. Hope this helps,

Hello, Amit What Harish is saying is as follows: instead of writing select distinct ItemId from InventTable you have to go around and use something like select ItemId from InventTable group by ItemId To help you with your large query we would have to see it first. Good luck!

Hi Guys, Thanks for your reply. I guess what you are saying makes sense and i need to use group by. In my sql query have achieved the same resultset that i needed by using group by . But how do i do the same in the AOT query object. can i set some property or sorting which will mean group By. Thanks in advance for your replies . I appreciate it a lot. Cheers Amit Sood

Thanks Guys for your help i got it working. But your help was useful.