Lesson 18ª

 

 

 

 

 

   

Queries II:

This lower portion is composed by a grid. We will study it with an example: What's the telephone number for George?

First, we need to know the fields in which we want the answer to be shown. We will need the fields "First Name", "Last name", and naturally the "Telephone" field. Therefore, we will choose at least these three. We can do this in 2 ways: looking for them in the table from the "Data Zone", or in the "Query Zone" by clicking on the field row. We will choose them after opening the available fields. This image show this example in a clearer manner.

As we mentioned before, we need to find George's telephone number. So, we will choose the fields First Name, Last name and Telephone.

Automatically, the value "Telephone guide 1" will be assigned to the "table" field, because we only have one active table. In case we had more than one, we would have to choose between them. The fields we select manually will appear marked with the option "View".

In the row "Criteria", we will introduce the data we know and on which we want to perform the search on. We need to introduce it in the field to which it belongs. In other words, we won't be searching for the name "George" in the "Telephone" column.

Once we have created the Query, the "Query Zone" will look like this:

To execute our Query, we need to click on the icon "Run".

And this will be the result:

With Access, we can perform several Criteria for searches. Functionally, it is like if we performed another Query on the result of a previous Query. For example, if we ask for all the First Names, Last Names and ZIP codes which live in Topeka, the Query would be:

And the result would be: