"Ferhat Bingol  webmail " <[EMAIL PROTECTED]> wrote on 02/02/2005 
03:31:00 PM:

> Hi all, 
> 
> I have case like this.
> 
> 
> 200312211750   14.65   0   14.65   14.65   6
> 200312211800   118.9   119.41   14.65   697.17 
> 200312211810   1324.1   122.6   697.17   1502.3   2
> 
> Last field is MODE. That case is at the middle of the database. But 
> these 3 are continues tripel. 
> 
> When MODE='' I need to know all the values of the previous and the next 
> rows.
> 
> Is there a SQL statement I can use, or do I need to write a code?
> 
> Regards,
> Ferhat
> 
> Is there a way to do that 
> -- 
> 
> 

UNLESS you provide an "order" to your data, there is no concept of "row 
before", or "row after" in SQL (excluding the CURSOR structure which MySQL 
does not support, yet). Results are, unless explicitly sorted, UNORDERED 
and are not guaranteed to appear in the same sequence even if you use the 
same SQL statement against the same data.

You can sort your results on one or more columns by using the ORDER BY 
clause. However it is a function of your database connection library (not 
the database server) to handle the results in some semblance of a 
sequence.  That means that if you want to find a record in your query 
results then look at the records that occur just before and just after, 
you will need to use a client-side recordset structure (what programming 
language and connection library are you using?) to do that sort of data 
navigation. 

There may also be other ways to approach this issue than through recordset 
navigation. What problem(s) are you trying to solve?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to