S
(Shovel)
Guest
Hello, so far I'm doing alright at this mySQL business, but I'm having one niggling problem with the current module I'm working on.
I'm writing a "block" (phpnuke speak for "a bit of menu") to display the 10 most recent column entires.
Columns are kept in just one table, so it's a nice simple query:
This means that I get the last 10 column entires. However, the GROUP BY, to eliminate duplicate entries (I only want one per author), causes it to display the *FIRST* entry by that author, not the most recent.
Can anyone offer some guidence on getting it to give me the latest entry rather than the first?
Thanks
I'm writing a "block" (phpnuke speak for "a bit of menu") to display the 10 most recent column entires.
Columns are kept in just one table, so it's a nice simple query:
Code:
$sql = "SELECT `column_id`, `author_id`, `title`, `date`, `time` FROM `column` GROUP BY `author_id` ORDER BY `column_id` DESC LIMIT -10;
This means that I get the last 10 column entires. However, the GROUP BY, to eliminate duplicate entries (I only want one per author), causes it to display the *FIRST* entry by that author, not the most recent.
Can anyone offer some guidence on getting it to give me the latest entry rather than the first?
Thanks