hi all,
I have a system where users can add comment to a picture (Gallery system).
When the users opens the webgalley he first sees the last comments made by
the users (the last 8). I could use a simple SELECT and ORDER BY on the
timestamp but when users would make 8 comments to a picture all the last
comments would be taken by that sole picture. My system should be somewhat
more intelligent and not give the last comments but give the last commented
pictures. So when 8 comments are made to one picture it would only appear
once in the last comment.
Via some INNER JOINS I query the pictureID ORDERED BY the timestamp (when
the comment was made). I though I 'd simply change the SELECT into a SELECT
DISTINCT but this doen't seem to work. I get a totally different result.
When I use SELECT I get
1704
1638
1637
1623
1623
1622
1621
1607
With SELECT DISTINCT this should be (I think)
1704
1638
1637
1623
1622
1621
1607
...
Instead I get a totally different result. Is this possible? If so, I
probably misunderstand the DISTINCT feature. I hope someone can help me out.
regards
Stijn
I have a system where users can add comment to a picture (Gallery system).
When the users opens the webgalley he first sees the last comments made by
the users (the last 8). I could use a simple SELECT and ORDER BY on the
timestamp but when users would make 8 comments to a picture all the last
comments would be taken by that sole picture. My system should be somewhat
more intelligent and not give the last comments but give the last commented
pictures. So when 8 comments are made to one picture it would only appear
once in the last comment.
Via some INNER JOINS I query the pictureID ORDERED BY the timestamp (when
the comment was made). I though I 'd simply change the SELECT into a SELECT
DISTINCT but this doen't seem to work. I get a totally different result.
When I use SELECT I get
1704
1638
1637
1623
1623
1622
1621
1607
With SELECT DISTINCT this should be (I think)
1704
1638
1637
1623
1622
1621
1607
...
Instead I get a totally different result. Is this possible? If so, I
probably misunderstand the DISTINCT feature. I hope someone can help me out.
regards
Stijn
Comment