Forum > Databases

How to get a list of unique values for a given column from TDataset

(1/2) > >>


Is there a "standard" way to get all the unique values for a given column in TDataset? I can loop my self and find them, but I'm sure I'm not the first one to encounter this problem so I'm looking for more official way.

EDIT: To be sure the data source is not a database, and I explicitly wish to achieve this with data already loaded into a dataset   


I would add them to a TStringList with duplicates turned off.

Depending on the database, the SQL keyword DISTINCT or DISCTINCTROW exists.

Nevermind, if that column is already defined as "UNIQUE" then you just SELECT it, since the DB enforces uniqueness of values for that column

@zvoni @devEric69

The data source is not a database.


That seems like an option. Are there any alternative (assuming the column is not a string and I would like to avoid the conversion) ?


[0] Message Index

[#] Next page

Go to full version