SQL query: Last but one rank for user
Posted
by Derk
on Stack Overflow
See other posts from Stack Overflow
or by Derk
Published on 2010-05-05T08:50:03Z
Indexed on
2010/05/05
14:08 UTC
Read the original article
Hit count: 206
My table structure looks like this:
create table rankings (
id IDENTITY NOT NULL,
user_id INT NOT NULL,
game_poule_id INT NOT NULL,
rank INT NOT NULL,
insertDate DATETIME NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (game_poule_id) REFERENCES game_poules(id) ON DELETE CASCADE
);
All old rankings of users per game are saved in this table. Now I want to have the last but one rank in the table for all users in a gamepoule.
Has someone an idea how to achive this? Thanks
© Stack Overflow or respective owner