Improved SQL filtering (getting distinct elements of a collection )

73 views
Skip to first unread message

Olakunle Olaniyi

unread,
Sep 29, 2014, 11:20:36 AM9/29/14
to orient-...@googlegroups.com
Hello,
My question refers to this article ; 




This is a great feature no doubt. But what if I am only interested in getting distinct friend names from the list and say not the first or the last or some data with a know index?
E.g for a collection such as ['a','a','b','c','c','g'] I would like to get back (a,b,c,g). 
How can i achieve that ?


Thanks,

Olakunle

Luca Garulli

unread,
Sep 29, 2014, 11:23:02 AM9/29/14
to orient-database

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Olakunle Olaniyi

unread,
Sep 29, 2014, 11:31:34 AM9/29/14
to orient-...@googlegroups.com
Tried it already, it doesn't work. 

--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/JfhWJhGu4FY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Olakunle

Luca Garulli

unread,
Sep 29, 2014, 11:33:42 AM9/29/14
to orient-database
Olakunle,
the "doesn't work" in IT means nothing, please be more precise:
- do you have any exception?
- what's the query?
- what's the db content?

Lvc@

Olakunle Olaniyi

unread,
Sep 29, 2014, 11:40:26 AM9/29/14
to orient-...@googlegroups.com
Here is a sample of what am trying to do with it : 

i have a query that returns a collection like I stated above [a,a,a,b,b,c,g,f]  (parenthesis intentionally omitted) . When i use distinct([a,a,a,b,b,c,g,f]) it returns the same collection as before [a,a,a,b,b,c,g,f] .
But the method asSet() returns distinct elements as I expected.

Hope this helps.

Luca Garulli

unread,
Sep 29, 2014, 11:53:53 AM9/29/14
to orient-database
Hi,
distinct() works on result set (multiple records), but if you have a collection to filter, you're right: asSet() is what does the job.

Lvc@

Reply all
Reply to author
Forward
0 new messages