Specific Query
Hi all.
I am trying to figure this out. I am running a query through PHP and this is what I want to do:
Take only the rows from the database where the parent_id is distinct (i.e. no repeats) AND ordered desc according to create_t column.
Here's the db setup:
id | parent_id | child_id | des | name | create_t | author |
int | int | int | text | text | datetime | text |
So, I have tried:
SELECT * FROM `table` GROUP BY parent_id ORDER BY create_t DESC
While that gets 1/2 what i want, it only selects the first two rows from the group. So the latest datetime timestamp isn't used, but rather the earliest.
I've also tried others, but nothing seems to work. Is there a better way to do this?
~Brett
Subject
Written By
Posted
Specific Query
April 29, 2005 12:00AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.