web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Implement first only record for joining tables in AOT Queries

(0) ShareShare
ReportReport
Posted on by

Hi Team,

I am developing some AOT queries. There is some duplicates data are in joining tables. I tried to fix it by first only property set to true but its not working with inner join.

I need a solution so that I could fetch single record on the basis of duplicates data column.

I tried with Group by option as well but this way i am getting error as i set range in the same query. 

parent table

pastedimage1605625228817v2.png

join table

pastedimage1605624946367v1.png

Thanks

Ashok Kumar

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ashok,

    What is the desired result from the query? Please provide a query in SQL or X++.

    Also please share screenshot(s) of the query you developed that is not working.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Ashok,

    Are you trying to join CustTable with another table with 1-n relationship? If you need to make 1-1 relationship between tables with 1-n relationship, you can make a view for the child table and apply group by criteria in view to make a single record. Then you just join the parent table and created a view in the query.

    One standard example is CustPackingSlipMinMaxDates view, which selects minimal and maximum dates from sales packing slips per line, and later if the view joined to sales line it doesn't create duplicates

  • Community Member Profile Picture
    on at

    Hi Sergei,

    I am developing a query that's have parent table is custtable and its join with shippingcarrieraddress table.

    In shippingcarrieraddress, there is a field named "shippingcarrieraccount". I need this field value to populate in my  view. But i need single record as we have same shippingcarrieraccount value for single customer.

    My view name is custtoshipview. This view retrieving all the delivery address for a specific customer.  please see the screen shot below.

    pastedimage1605631156030v1.png

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Ashok,

    You can create a new view and add the table ShippingCarrierAddress as a data source. CustAccount, DlvTermId, and DlvModeId should be added to the group by section and to the list of fields for the new view. ShippingCarrierAccount should be added to the list of fields and aggregation property should be set to Min or Max. After you compile and sync the view, you can use it instead of ShippingCarrierAddress in your query.

    But note that if you will have different ShippingCarrierAccount for the same CustAccount, DlvTermId, and DlvModeId records you will get only one value in the view.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans