I had a requirement in which one record was associated with a list of checkboxes that can sometimes grow. To meet this I uses a 1:m relationship. It may be better using an example.
A research application can come in and it can be of one or many projecttypes. It can also utilize one or more procedures, and be conducted in one or more departments. To take the easy way out, I created enums for projecttypes, procedures and departments. If there was a requirement for additional, I would just add another enum in the enumtype. And the dB design was:
Application(1) : ProjectType(n) where projecttype had 2 columns Application_ID_FK(int) and Project_Type(varchar). Same goes on for procedures and departments.
The end user will see a list of checkboxes and make a determination as to which projecttype his application was and which departments it would be conducted in and what kind of procedures it utilized.
Now I have a requirement to do an advanced search wherein a user may want to find out all projects which are of projecttype type1 and type2 and conducted in dept1 and dept2 which also utilizes procedures 1 and procedure 2.
How should I go about building a query using llblgen with the exisiting design?
Would it be easier if I put all the projecttypes, depts and procedures in one field each like so |projType1||projType2||projType3| in projecttypecolumn, |dept1||dept2| in Dept column and |proc1||proc2| is proceduresutilized column and then search using 'like'
e.g if i want to find applications where projectype is of type1 and type3, I say
where projecttypecolumn like '%|type1|%' and projecttypecolumn like '%|type3|%'
Or is there a better way to do this with my existing 1:n design using groups and having, but stillable to dynamically build the predicateexpression?