Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / select certain fields
Finance forum
Unanswered

select certain fields

(0) ShareShare
ReportReport
Posted on by
 Is there a way to only select few fields without the need to put select RecId for all other un-needed table fields? (I had to select RecId because i don't need other fields and to enhance performance). But is it doable to only select 3 fields without the need to repeat recId?

while select RecId from table1 where table1.Field1 == 'XX'
    join RecId from table2 where table2.FieldX == table1.Field2
        && table2.IsField4 == NoYes::Yes
    join Field5 from table5 where table5.RecId == table3.Field6
    join Field7, Field8 from table6 where table6.Field9 == table5.RecId 
{
    info(strFmt(/Field5: %1/,table5.Field5));
    info(strFmt(/Field7: %1/,table6.Field7));
    info(strFmt(/Field8: %1/,table6.Field8));
}

maybe if i put them in view it will work.. but i want to see if i can do it in x++
  • Martin Dráb Profile Picture
    Martin Dráb 230,842 Most Valuable Professional on at
    select certain fields
    It doesn't matter. SQL is a declarative language - you describe what data you want; you don't define how the query will be executed (although you can influence it). Execution details are decided by SQL Server Query Optimizer.
  • Suggested answer
    MuthukumaranAX Profile Picture
    MuthukumaranAX 2,901 on at
    select certain fields
    you can rewrite the condition like,
    write select logic for table 5 and 6 with the field list use join statement and for the other table you can use exist join
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,842 Most Valuable Professional on at
    select certain fields
    You could change the order of tables in the select statement and use exits join for table1 and table2.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans