Hello Jay!

My example schema describes positions on a chessboard. I am aiming to make
the neighbourhood relation explicit. From the line/row sorted view I want to
associate to each entry the predecessors row value as northern bound of
horizon and the successors as the southern bound. I'd like to do so for all
axis of the board. If the problem is solved for the vertical axis, it can be
solved for each other axis with appropriately sorted versions of
extended_position. - So how can I get the row value of the
predecessor/successor, if there is one in the same line, or just the
information that there is no p/s with the same line value.
Given that case, I know that the same game starts again.


- Okay, now here's a snippet of the code. It's like that:

create table position (
        piece_colour VARCHAR(1),
        piece_type VARCHAR(1),  
        line INT(1),
        row INT(1),
        PRIMARY KEY(line,row)    
);


create view extended_position as 
select piece_colour, piece_type, line, row, row-line as diagonal, line+row-9
as counter_diagonal, row-1 as offset 
        from position;

create view extended_position_by_line_row as
        select * from extended_position
        order by line asc, row desc;



-- 
View this message in context: 
http://www.nabble.com/selecting-rows-of-the-view-via-its-position-tf1991602.html#a5467865
Sent from the SQLite forum at Nabble.com.

Reply via email to