Cool!

Thank you.

At 10:58 AM 1/10/2007 -0800, James Keeline wrote:
>--- Emily Berk <[EMAIL PROTECTED]> wrote:
>
>> Let's say I have a set of records and I want to retrieve the first and the
>> last (ordered by, say, the value of one of the columns).
>> 
>> Is there 
>> 
>> To get either the first or the last, I'm assuming I would
>> 
>> Select * order by columnX ASC LIMIT 1 
>> 
>> and to get the last I'd order descending.
>> 
>> But how would I get both the first and the last in one query?  
>> 
>> Emily Berk
>> http://www.armadillosoft.com
>
>You could UNION the two queries:
>
>SELECT * ORDER BY columnX ASC LIMIT 1
>UNION
>SELECT * ORDER BY columnX DESC LIMIT 1;
>
>James Keeline
>
>
>
>Community email addresses:
>  Post message: [email protected]
>  Subscribe:    [EMAIL PROTECTED]
>  Unsubscribe:  [EMAIL PROTECTED]
>  List owner:   [EMAIL PROTECTED]
>
>Shortcut URL to this page:
>  http://groups.yahoo.com/group/php-list 
>Yahoo! Groups Links
>
>
>

Emily Berk
http://www.armadillosoft.com


Reply via email to