In message <[EMAIL PROTECTED]>, Pete <[EMAIL PROTECTED]>
writes
>In message <[EMAIL PROTECTED]>, Pete <[EMAIL PROTECTED]>
>writes
>>I tried this, because I have something similar that I need - "show me
>>the next and previous record WHERE... "
>>
>>But I can't get your example to work, I get the error message
>>"Incorrect usage of UNION and ORDER BY"
>>
>>The full SQL command that I am using is
>>SELECT * from sales ORDER BY salID ASC LIMIT 1 
>>UNION 
>>SELECT * from sales ORDER BY salID DESC LIMIT 1; 
>>
>>Have I done something silly?
>
>Yes, I have <G> - it should be
>(SELECT...LIMIT 1) on both lines!

So, replying again to my own email:

I don't use UNION very often - I don't suppose many people do!  But is
it slow?  All I am getting on my crude log for the above is 0ms, so it
appears to be pretty much the same as other simple queries.  And I would
assume that it is quicker than two queries, one for 'previous' and one
for 'next'.

It's not something that is worth testing, but if anyone already knows, I
would be interested.

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

Reply via email to