hi all,
I have a table I want to interrogate
tblcomment:
CREATE TABLE `tblcomment` (
`ID` int(11) NOT NULL auto_increment,
`IDSubonderdeel ` int(11) NOT NULL default '0',
`IDPoster` int(11) default NULL,
`timestamp` int(11) default NULL,
`inhoud` text NOT NULL,
PRIMARY KEY (`ID`)
) TYPE=MyISAM
Id is the primary key and timestamp contains the date when the comment was
posted. IDSubonderdeel is the ID of the picture comment has been posted too
(more than one comment can be posted to one picture) I want to return a
result containing unique IDSubonderdeel ordered by timestamp (basically what
picture was commented last). SELECT DISTINCT `tblcomment`.`I DSubonderdeel`
FROM `tblcomment` ORDER BY timestamp DESC LIMIT 10 should do the trick but
apparently doesn't return the correct timestamp order. When I make comment
to a picture (IDSubonderdeel ), that picture isn't always first in the query
row. Somoen knows what I m doing wrong?
regards
Stijn
I have a table I want to interrogate
tblcomment:
CREATE TABLE `tblcomment` (
`ID` int(11) NOT NULL auto_increment,
`IDSubonderdeel ` int(11) NOT NULL default '0',
`IDPoster` int(11) default NULL,
`timestamp` int(11) default NULL,
`inhoud` text NOT NULL,
PRIMARY KEY (`ID`)
) TYPE=MyISAM
Id is the primary key and timestamp contains the date when the comment was
posted. IDSubonderdeel is the ID of the picture comment has been posted too
(more than one comment can be posted to one picture) I want to return a
result containing unique IDSubonderdeel ordered by timestamp (basically what
picture was commented last). SELECT DISTINCT `tblcomment`.`I DSubonderdeel`
FROM `tblcomment` ORDER BY timestamp DESC LIMIT 10 should do the trick but
apparently doesn't return the correct timestamp order. When I make comment
to a picture (IDSubonderdeel ), that picture isn't always first in the query
row. Somoen knows what I m doing wrong?
regards
Stijn
Comment