Closed alexgv closed 11 years ago
Hey! i've been busy with office stuff. It would be great of you can give me a hand in fixing this bug. You can fork the project and send me a pull request.
Thanks.
ok, i figured out the problem. Read here to get the full explanation here
In short, this type of query is only supported by PostgreSQL as of now. It uses a "SELECT DISTINCT ON" construct which HANA doesn't supports. Hence, you can only use distinct() not distinct(fields).
Got ya. I guess when I send it the fields in the sql directly it really does not filter by eff date but by which one is distinct
Running a distinct query does not work if I run the following django it will produce the following sql
Django:
OrgBuilder.objects.order_by('Eff_Date').distinct('Eff_Date')
The sql will produce:
SELECT DISTINCT (OrgBuilder_orgbuilder.Eff_Date) OrgBuilder_orgbuilder.id, OrgBuilder_orgbuilder.Eff_Date, OrgBuilder_orgbuilder.instID, OrgBuilder_orgbuilder.Valid_From, OrgBuilder_orgbuilder.Valid_To, OrgBuilder_orgbuilder.Enable, OrgBuilder_orgbuilder.UserID_id FROM OrgBuilder_orgbuilder ORDER BY OrgBuilder_orgbuilder.Eff_Date ASC
that generates the following error:
Error: (257, 'sql syntax error: incorrect syntax near ".": line 1 col 50 (at pos 50)')
The sql it should produces should be like the following:
SELECT DISTINCT OrgBuilder_orgbuilder.Eff_Date FROM studentcloud_developer.OrgBuilder_orgbuilder ORDER BY OrgBuilder_orgbuilder.Eff_Date ASC
@kapilratnani