cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Jumpa
Level: Powered On

Help with IN/NOT IN query

I've the following query:

 

SELECT *

FROM A

WHERE id NOT IN (SELECT id_A FROM A_B)

OR id IN (SELECT id_A FROM A_B WHERE c = 2)

 

id_A is a foreign key from A imported in A_B.

What's the equivalent for IN and NOT in operator for powerapp? Many thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help with IN/NOT IN query

Hi @Jumpa ,

Do you want to achieve your search query using PowerApps formula as your SQL syntax?

 

Based on the needs that you mentioned, I have made a test on my side. Please consider take a try with the following workaround:

Add a Gallery within your app, set the Items property to following:

Filter(
         '[dbo].[A]',
          Not(id in '[dbo].[A_B]'.id_A) || id in Filter('[dbo].[A_B]', c=2).id_A
)

Note: The IN operator in SQL Server is equivalent to in operator, the NOT IN operator is equivalent to Not(.. in ...) formula as above.

 

More details about the operators supported in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators

 

More details about the Filter function, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Help with IN/NOT IN query

Hi @Jumpa ,

Do you want to achieve your search query using PowerApps formula as your SQL syntax?

 

Based on the needs that you mentioned, I have made a test on my side. Please consider take a try with the following workaround:

Add a Gallery within your app, set the Items property to following:

Filter(
         '[dbo].[A]',
          Not(id in '[dbo].[A_B]'.id_A) || id in Filter('[dbo].[A_B]', c=2).id_A
)

Note: The IN operator in SQL Server is equivalent to in operator, the NOT IN operator is equivalent to Not(.. in ...) formula as above.

 

More details about the operators supported in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators

 

More details about the Filter function, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Users Online
Currently online: 124 members 5,292 guests
Please welcome our newest community members: