I have a table that holds topic types another that holds materials. I then have another table which holds the keys of each table thus creating the many to many relation.
However, when I try to search the topics to pick out two topics which have share the same material it doesn't work.
Example tables:
Material Table:
MatID | Name
---------------
1 | book1
2 | note23
Topic table:
TID | topic
---------------
1 | computer
2 | database
MatTop table:
TID | MatID
------------
1 | 2
2 | 2
This is my query:
SELECT * FROM material
INNER JOIN mattop ON material.MatID = mattop.MatID
INNER JOIN topic ON mattop.TID = topic.TID
WHERE (topic.topic = 'computer') AND (topic.topic = 'database')
Thanks for any help.
EDIT - I know that the AND is the error sorry. I meant how do I get it to output the materials that have the topics associated with it.