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!

Categories

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.

[b]FlagsRequiredID___FundNameID___FlagID[/b]
______1_______________1____________3
______2_______________2____________5
______3_______________6____________7
______4_______________7____________2
______5_______________7____________8
______6_______________9____________7

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.