Queries

  • Thread starter Thread starter JA
  • Start date Start date
J

JA

Guest
There is probably a very simple answer to this question - I am trying to write a query i.e if you have a database of school children, I am trying to find out how many people I have with the name Mark, John and Kate. I know I can use 'or' but I want 'and' not 'or'.

Can anyone help?

Thanks
 
This may be what you are looking for.

Hope it helps
Hay
 

Attachments

if you want to get all records where the name is one of the three, Mark, John or Kate then 'OR' is what you use.

In criteria in a query under your name field enter
Mark or John or Kate

The above assumes of course that your name field just contains the pupils first name. If it includes 2nd initial and/or surname then you should set criteria of
mark* or john* or kate*

Access will automatically fill in 'like' before each of the names.

If you just want Totals for each of the names then do a Totals query, put in the name field twice, put the criteria under one and set to 'Count' in the totals row. This would then give results of

Example:
Mark 10
John 25
Kate 8

If you want a result of 43 then need to set 'Where' in the totals row.
 

Users who are viewing this thread

Back
Top Bottom