Skip to content

Distinct

mtbeek32 edited this page Jan 2, 2023 · 8 revisions

The Select Distinct ... From ... DML statement is used to select unique occurrences of one or more attributes from a table.

single attribute selection

Assume the following SQL Statement:

Select Distinct Town From Appartment

This statement can be applied on our relation model, resulting in the following data:

link=Special:FilePath/Relation_select_distinct_from.png

For a SQL Distinct statement in the GeoDMS a new domain unit needs to be configured with the unique function. This function generates a subitem called Values, containing the unique occurrences of it's argument, in alphabetic order.

GeoDMS configuration (the Appartment domain unit is configured in a src container):

unit Town := unique(src/Appartment/Town);   

multiple attributes selection

Assume the following SQL Statement:

Select Distinct Town, ZipCode From Appartment

The GeoDMS unique function does not support multiple arguments. Therefore concatenate the Town and ZipCode attributes, see the example:

unit TownZipCode := unique(src/Appartment/Town + '_' + src/Appartment/ZipCode);

Clone this wiki locally