Hi All,
Can anybody provide me a clear picture of joins used in X++ code.
Thanks.
*This post is locked for comments
Hi,
The joins are explained in the blow post,
axzaptech.wordpress.com/.../playing-with-data
Often when I think of queries and joins I find it easier to think about two dimensional tables, rows and columns, and how you can take two resultsets and join them together into a bigger resultset, from which you pick what columns to work on in the ending resultset.
So when you join two results, you provide the link between them, the criteria on how you link the two together. Either you have a single unique key, or a "key" based on a set of different columns.
When you join two results, you can either say you only want to have rows where there is a match on both results. This is called "inner join". Or you can say you always wants the row from one the resultsets and whatever is found in the joined resultset (left or right join in SQL).
You can then take the above and chain joins, but it is always a two-by-two join finally resulting in a result resultset.
Now, as for X++ we are sort of limited compared to SQL, because there are no left join, right join or inner join. All joins are left and inner by default. You do have the "outer" keyword if needed.
Here is a comparisson between SQL and X++ in regards of queries:
msdn.microsoft.com/.../dd261457.aspx
Here is how to use the outer join:
msdn.microsoft.com/.../gg845763.aspx
So basically X++ is simpler and more implicit for querying. This may pose a challenge in some scenarious, but I've always been able to design my way around those limitations.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 4
Martin Tocauer 4
Nayyar Siddiqi 2