Jump to content

Order By Name When ID Is In Field


ASK83

Recommended Posts

Hi, I'm currently developing a message center on a site and I'm trying to make options for sorting by name or date.  The date is simple, because there is a date time stamp in my message table, but the name is a bit more complicated..  The message table only stores a user_id, which I can use joins to retrieve the name when processing and echoing, but would it work the same with the ORDER BY syntax?  And to throw a little a curve ball into the situation, there are two different message senders - users and the user's aliases (stored in another table aside from users) - so how would I go about separating and ordering the names when initially querying the message table?

Link to comment
Share on other sites

There are two different ways the users can communicate - let's use this forum as a way to express this..  I can communicate by my login (ASK83), but let's say I was also trying to communicate to my neighbor who knows me by my first name (let's say John) - so I could send messages as my alias (ASK83) or my user (John).  If that helps any.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.