| 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.
- Select the Data source; for this example,
dbtoolboxdemo.
- Select the Tables; for this example,
SalesVolume.
- 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 |  |