Help required with query - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help required with query

I am writing an application to show students financial funding avaialable to them.

There are certain 'flags' that the users can select (e.g. disabled, mature, have kids), which will affect which funds are available to them.

The table below, FlagsRequired, shows the Fund and the Flags that have to be selected by the user in order to qualify for that fund.


The problem is that I need to select the funds from this table only if all the flags associated with that fund have been selected. For example, FundNameID 7 should have flags 2 and 8 selected to be avialable to the student.
The way my app is working is to pass the flags selected as a list.
I need to write a query that can select a Fund if multiple flags have been selected.
Example, I have ticked flags 1, 2, 5 and 8. From the table above, I would expect records with FundNameID 2 and 7 to be selected.
Similarly, if I had selected flags 7 and 8, I would expect records with a FundNameID of 6 and 9 to be selected (not 7).

Thanks in advance if anyone can help.
Sign In or Register to comment.