pyorient icon indicating copy to clipboard operation
pyorient copied to clipboard

SELECT DISTINCT ignores the first field specified

Open Penniman opened this issue 6 years ago • 1 comments

Execute a query such as:

SELECT DISTINCT userid, book_title, isbn FROM book_views

Will return an oRecordData object with fields for book_title and isbn but there will be no userid included. The same query executed in OrientDB Studio executes correctly and returns all fields.

My workaround has been to include a bogus field name:

SELECT DISTINCT pyorient_select_distinct_bug_workaround, userid, book_title, isbn FROM book_views

This is with OrientDB 3.0.15, PyOrient 1.5.5, and python 3.7.2.

Penniman avatar Mar 05 '19 16:03 Penniman

I have the same issue, BUT.... the results are different.... I believe it is using the old command (because of language). For example when I do query with no DISTINCT query in OrientDb I have 43958, with DISTINCT I get 8758 records. In Python without DISTINCT I receive 43958, with DISTINCT fake_column I also receive 43958. I believe is that the language used is not compatible with 3.0 ... check this new feature: https://www.orientdb.org/docs/3.0.x/release/3.0/SQL-Changes.html#distinct-keyword

civanescu avatar Aug 19 '22 10:08 civanescu