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 sco
"A.M." <[EMAIL PROTECTED]> writes:
> When I try to run the following query:
> select distinct on(student_gradedmaterial.id) ...
^^
> ... order by submittime desc;
^^^
> I get the following error:
> ERROR: SELECT DISTINCT ON expre
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
I'm not sure if I understood your problem,
but did you try with "distinct on"?
select distinct on (id)
from
...
order by submittime desc
Regards,
Tomasz Myrta
A.M. wrote:
> I have a table as follows:
> CREATE TABLE student_gradedmaterial(
> id SERIAL,
> studentid INT8 REFERENCES student
I have a table as follows:
CREATE TABLE student_gradedmaterial(
id SERIAL,
studentid INT8 REFERENCES student,
gradedmaterialid INT8 REFERENCES gradedmaterial,
caid INT8 REFERENCES ca,
...
submittime TIMESTAMP,
gradedtime TIMESTAMP,
score INT4
);
Every time a student submits a homewo