This article was previously published under Q154506
SUMMARY
This article contains answers to frequently asked Database query
questions.
MORE INFORMATION
Q. How do I perform text queries in Works?
A. In a very large database, it may be useful to perform a query
that has Works display only records that match the criteria
you specify.
For example, you can have Works show only records that have a value
in a State field of WA, or only records for customers whose first
name is Betty. The example below lists the steps to find all of the
records containing "Betty" in the field "First Name,"
On the Tools menu, click Create New Query.
In the Choose A Field To Compare box, select the First Name
field.
In the How To Compare The Field Box, select the appropriate
operator, for example, "Is Equal To" or "Contains".
In the Value To Compare The Field To box, type the search target
information. For example, Betty.
Click Apply Now.
Q. How do I query on a blank field?
A. To find records which contain a blank in a specific field, follow
these steps:
Follow steps 1-2 in Question 1 of this article.
In the How To Compare Field box, select Is Equal To, but leave
the Compare The Field To box blank.
Click Apply Now.
Q. How do I query on a range of dates?
A. You can query on a range of dates by using the AND operator in
conjunction with two comparison statements. For example, if you
want to find all records whose date falls from 7/1/93 to 9/30/93,
follow the steps below:
On the Tools menu, click Create New Query.
In the Choose A Field To Compare box, select the Date field.
In the How To Compare The Field box, select Is Greater Than Or
Equal To.
In the Value To Compare The Field To box, type the starting
range of the date:
7/1/93
Click the AND operator between the first and second rows.
Repeat step 2 on the second row of query criteria.
On the second row of query criteria, repeat step 3, but select
Is Less Than Or Equal To.
On the second row of query criteria, repeat step 4 but type the
ending range of the date:
9/30/93
Click Apply Now.
Q. How do I query on a specific month?
A. In the Works database module, you can query for dates that fall in
a particular month with the MONTH() function. The MONTH() function
returns an integer from 1 to 12 specifying the month of the given
date. For example, if you need to find records that have May in a
field named "Birthday," use the steps below:
On the Tools menu, click Create New Query.
Click Query View.
Press DELETE to remove any formula that appears.
In the Birthday field, type the following formula:
=month()=5
On the View menu, click List to see the results of your query.
NOTE: The examples in this question match all records where a date
entry contains a month of May, regardless of the year. To find
records in a certain year, use the YEAR function. For example, to
find records only for May of 1995, use the following formula: