Re: Finding a Solution To A Distinct Problem of Mine

2007-03-13 Thread John Kopanas
GROUP BY from_user_id; In your original query I think you meant to select from, not to, since to will be 1; - Original Message - From: "John Kopanas" <[EMAIL PROTECTED]> To: Sent: Sunday, March 11, 2007 12:59 PM Subject: Re: Finding a Solution To A Distinct Problem of Mi

Re: Finding a Solution To A Distinct Problem of Mine

2007-03-12 Thread Brent Baisley
be 1; - Original Message - From: "John Kopanas" <[EMAIL PROTECTED]> To: Sent: Sunday, March 11, 2007 12:59 PM Subject: Re: Finding a Solution To A Distinct Problem of Mine I think I got it: SELECT * FROM (SELECT * FROM messages ORDER BY created_at DESC) as messages

Re: Finding a Solution To A Distinct Problem of Mine

2007-03-11 Thread John Kopanas
Ok, did not work... hmmm... any other suggestions? On 3/11/07, John Kopanas <[EMAIL PROTECTED]> wrote: I think I got it: SELECT * FROM (SELECT * FROM messages ORDER BY created_at DESC) as messages WHERE to_user_id = 1 GROUP BY from_user_id; Is this the best way about it... or are their better

Re: Finding a Solution To A Distinct Problem of Mine

2007-03-11 Thread John Kopanas
I think I got it: SELECT * FROM (SELECT * FROM messages ORDER BY created_at DESC) as messages WHERE to_user_id = 1 GROUP BY from_user_id; Is this the best way about it... or are their better ways you suggest? On 3/11/07, John Kopanas <[EMAIL PROTECTED]> wrote: I have the following table: mess

Finding a Solution To A Distinct Problem of Mine

2007-03-11 Thread John Kopanas
I have the following table: messages: if: from_user_id: to_user_id: body: created_at: updated_at: I have to return all the rows that have a distinct from_user_id based on a to_user_id. Not only that but I want to return the rows with the newest created_at. I thought this would work: SELE