Database Toolbox |
|
Retrieving Unique Occurrences
In the Visual Query Builder Advanced query options, select Distinct to limit results to only unique occurrences. Select All to retrieve all occurrences. For example:
- Set Preferences; for this example, set Data return format to
cellarray
and Read NULL numbers as to NaN
.
- For the Data operation, choose Select.
- From Data source, select a data source; for this example,
dbtoolboxdemo
.
- From Tables, select a table; for this example,
SalesVolume
.
- From Fields, select the fields; for this example,
January
.
- Run the query to retrieve all occurrences.
- In Advanced query options, select All.
- Assign a MATLAB workspace variable; for this example,
All
.
- Click Execute.
- Run the query to retrieve only unique occurrences.
- In Advanced query options, select Distinct.
- Assign a MATLAB workspace variable, for this example,
Distinct
.
- Click Execute.
- In the Data area, the Workspace variable - Size shows
10x1
for All
and 8x1
for Distinct
.
- In the Command Window, type
All, Distinct
to display the query results.
- The value
3000
, appears three times in All
, but appears only once in Distinct
.
| Fine-Tuning Queries Using Advanced Query Options | | Retrieving Information That Meets Specified Criteria | |
© 1994-2005 The MathWorks, Inc.