I have a Subjects table with a field Prerequisites, which contains data similar to the Subject IDs in the same table. So for example a subject4 may have the prerequisites subject2 and subject3. The contents of the Prerequisite field are delimited by ORs and ANDs, meaning if there are more than one prerequisites then the other may be optional or required. Anyway, I've a problem with selecting subjects with more than one prerequisite. How do I do this? If there's just one I could just do SELECT subjectID FROM Subjects WHERE Prerequisites = subjectID or something but I dont know how to include the delimiters.

Can you show some sample data?

The subjects table has the fields:
Subject Code, Description, Prerequisites
contents ex: CPRG 1, Fundamentals of Programming 1, None
ex with prerequisites: PPL, Principles of Programming Languange, CPRG 1 and CPRG 2
another: OOP, Object-Oriented Programming, CPRG 1 or CPRG 2

I've solved the problem by splitting the prerequisites field into three, one for the first, another for AND prerequisites and another for OR. It's not the best solution, but I had to find a way around the problem. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.