tags:

views:

46

answers:

2

I got a table Assignments which contains the logs if a user is assigned with a quiz.What I want is to select the latest user_id's. How do I do this? Thanks in advance!

P.S. I want the unique id's with the latest created fields

+3  A: 

There's not a lot of information to go on but maybe

SELECT * FROM table WHERE user_id = (SELECT MAX(user_id) FROM table)
Kamal
A: 

Hi, this is alternative

SELECT TOP 1 *
FROM table
ORDER BY user_id DESC
IordanTanev
unfortunately this doesn't work in all SQL-dialects.
lexu
It is possible please but i don't see any version specified in the question.This works with all the versions of MSSQL
IordanTanev