Hi! I have been asked to sort a table into a patricular order to be used with a mail merge, however, I have no idea where to start with the query!
The table currently consists of Schoolname, Address, Subject.
Single schools can have multiple subjects. For example,
, may return 4 rows, all the same except for the 'Subject' column, which could contain 'Mathematics', 'English', 'Science', and another 'Mathematics' - for good measure.
Now for the query:
I want to sort the table by schools, based on what subjects they have.
For instance, I want the address of a school that has english maths and science, but does not have art, is this possible?
I've tried
But of course it gets all schools that have EITHER of those subjects, not schools that have all 3 subjects.
Thanks for your time in reading this essay!
The table currently consists of Schoolname, Address, Subject.
Single schools can have multiple subjects. For example,
Code:
SELECT * WHERE schoolname='The Streetly School'
Now for the query:
I want to sort the table by schools, based on what subjects they have.
For instance, I want the address of a school that has english maths and science, but does not have art, is this possible?
I've tried
Code:
WHERE subject='mathematics' OR WHERE subject='English' OR WHERE subject='science'
Thanks for your time in reading this essay!
Comment