Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 simple select stmt

Author  Topic 

mac
Starting Member

3 Posts

Posted - 2001-08-20 : 20:29:11

I have 2 tables as follows:

create table User
(idUser int,
Name varchar)

create table Score
(idUser int,
score int,
dtAdded datetime)

User
idUser name
------ ----
1 Peter
2 Sam
3 Vicky

Score
idUser score dtAdded
----- ----- -------
1 7 8/18/2001
1 5 8/19/2001
3 9 8/17/2001
3 8 8/15/2001

and I want a select stmt to show the following result:

idUser LatestScore dtAdded
------ ----------- -------
1 5 8/19/2001
2 NULL NULL
3 9 8/17/2001

It seems obvious but I just get stuck somehow...

Any ideas would be appreciated.

-- Mac
   

- Advertisement -