You need to sign in to do that
Don't have an account?

soql distinct values
hi i want to get distinct values from the list of values
i have a filed called brandcategory in this i have some data from this i want get distinct values in my visualforce page
example: in my filed i have this data
1
1
2
2
3
4
5
and i have to show result in my vf like this
1;2;3;4;5
how can we achive this
can any one help me
thanks for advance to all
To do it in apex, simply add elements to a Set, which by virtue of being a collection of unique elements will only admit elements to be added once.
You can then iterate over the set to get the unique elements.
To do it in SOQL use HAVING with Group By (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_having.htm)