J
Jeff Gaines
I need to keep records in an Access 2007 database that belong to one main
category and any number (in practice between 1 and 12 usually) of sub
categories. Currently I keep the main category as an integer and the sub
categories as a string which is a csv list, e.g. 1,3,5,7,9,11.
The database is driven by a front end written in C# so converting the csv
list to a List<int> and back to a csv list is straightforward in the
program.
However, what I can't do is to create a SQL statement to pull records off
the database that are in, say, main category 2 and sub-category 7. I keep
a second table which has one record for each main category/sub category
combination with the original record number in it so I can search that by
main cat and sub cat and get the affected record numbers.
Can anybody give me any pointers to a better way of setting up the main
table so that I can query it directly for a main cat/sub cat combination?
If there were always a fixed number of sub-categories it night be easier
but this isn't an option.
Pointers to websites covering the subject would be good as well. It looks
a bit like a home-work question but the last time I had home-work was 44
years ago honest!!!
Many thanks.
category and any number (in practice between 1 and 12 usually) of sub
categories. Currently I keep the main category as an integer and the sub
categories as a string which is a csv list, e.g. 1,3,5,7,9,11.
The database is driven by a front end written in C# so converting the csv
list to a List<int> and back to a csv list is straightforward in the
program.
However, what I can't do is to create a SQL statement to pull records off
the database that are in, say, main category 2 and sub-category 7. I keep
a second table which has one record for each main category/sub category
combination with the original record number in it so I can search that by
main cat and sub cat and get the affected record numbers.
Can anybody give me any pointers to a better way of setting up the main
table so that I can query it directly for a main cat/sub cat combination?
If there were always a fixed number of sub-categories it night be easier
but this isn't an option.
Pointers to websites covering the subject would be good as well. It looks
a bit like a home-work question but the last time I had home-work was 44
years ago honest!!!
Many thanks.