Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

A Problem with creating the query x++

Posted on by 2,016

Greeting everyone 

by using while select i'm really confused to how create a query by x++ for my request?

i have this table 

plans.JPG

i have tow request from this table i don't know get it by x++ select 

1-i need employees which have only (Plan==PlanA &&  Status==Open) must this employees doesn't have another different row

and the result should be 
(Katey , Ben) 

others will be ignored because they have more than this satiation Plan and Status

2-i need employees which have only (Plan==PlanB &&  Status== Close )must this employees doesn't have another different row

and the result should be 
(Sara) 

others will be ignored because they have more than this satiation Plan and Status

i really try many select but all gone wrong how can i do that also i did used group by but still not give me the result which i need?

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: A Problem with creating the query x++

    Record record;

    Record notExistsRecord;

    -- first case

    select record 

    where record.Plan=='PlanA'

    &&  record.Status=='Open'

    notexists join notExistsRecord

    where record.Plan == notExistsRecord.Plan

    && record.RecId != notExistsRecord.RecId;

    --second

    select record 

    where record.Plan=='PlanB'

    &&  record.Status=='Closed'

    notexists join notExistsRecord

    where record.Plan == notExistsRecord.Plan

    && record.RecId != notExistsRecord.RecId;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans