Jump to content

help in "order by" mysql


mekha

Recommended Posts

i have 2 tables:1) father table.. (posts table)2)child table.. (comments table)now i ordered the results by (id of father) desc.....now what i want is if comment on some post,,,this post is being the first in the order!..any help please ?what query to use?

Link to comment
Share on other sites

Hmm... You would need to join the tables. I think something like this might work:

SELECT posts.field1, posts.field2 FROM posts, comment WHERE comment.parent = post.id ORDER BY comment.date

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...