MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Don Read Date:August 19 1999 2:11pm
Subject:RE: Reverse select statement
View as plain text  
On 20-Aug-99 Mick Hanna wrote:
> SELECT * FROM messages where username="bob" and to_user="fred";
> 
> i want the select statement to do the reverse at the same time and mix the
> rows together
> ordered by a timestamp......
> ie:
> one select for:
> 
> SELECT * FROM messages where username="bob" and to_user="fred" order by
> timestamp;
> SELECT * FROM messages where username="fred" and to_user="bob" order by
> timestamp;

you might have been looking at it too long.

 SELECT * FROM messages 
  where ( username="bob" and to_user="fred" ) or
  ( username="fred" and to_user="bob" )
  order by ...

Regards,
---
Don Read                                 dread@stripped
EDP Manager                                  dread@stripped
Calcasieu Lumber Co.                               Austin TX
-- But I'm in good company, sendmail has kicked a great many 
     butts in the past
Thread
Reverse select statementMick Hanna19 Aug
  • RE: Reverse select statementDon Read19 Aug
    • Re: Reverse select statementMick Hanna19 Aug
  • Reverse select statementsinisa19 Aug