Database Toolbox Previous page   Next Page

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:

  1. Set Preferences; for this example, set Data return format to cellarray and Read NULL numbers as to NaN.
  2. For the Data operation, choose Select.
  3. From Data source, select a data source; for this example, dbtoolboxdemo.
  4. From Tables, select a table; for this example, SalesVolume.
  5. From Fields, select the fields; for this example, January.
  6. Run the query to retrieve all occurrences.
    1. In Advanced query options, select All.
    2. Assign a MATLAB workspace variable; for this example, All.
    3. Click Execute.
  7. Run the query to retrieve only unique occurrences.
    1. In Advanced query options, select Distinct.
    2. Assign a MATLAB workspace variable, for this example, Distinct.
    3. Click Execute.
  8. In the Data area, the Workspace variable - Size shows 10x1 for All and 8x1 for Distinct.
  9. In the Command Window, type All, Distinct to display the query results.

  1. The value 3000, appears three times in All, but appears only once in Distinct.


Previous page  Fine-Tuning Queries Using Advanced Query Options Retrieving Information That Meets Specified Criteria Next page

© 1994-2005 The MathWorks, Inc.