| От | Tomasz Myrta |
|---|---|
| Тема | Re: Getting the latest unique items |
| Дата | |
| Msg-id | 3DF84A2D.80004@klaster.net обсуждение исходный текст |
| Ответ на | Re: Getting the latest unique items ("A.M." <agentm@cmu.edu>) |
| Список | pgsql-sql |
A.M. wrote: > When I try to run the following query: > > select distinct on(student_gradedmaterial.id) student_gradedmaterial.id > from coursesection_student,student_gradedmaterial WHERE > gradedmaterialid=1 AND > coursesection_student.studentid=student_gradedmaterial.studentid AND > coursesectionid=1 and score is not null order by submittime desc; > > I get the following error: > > ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY > expressions No You have to change your sort order (as in error above). It should be: order by student_gradematerial.id asc, submittime desc; Tomasz Myrta
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера