Click here to Skip to main content
15,905,028 members
Home / Discussions / Database
   

Database

 
GeneralRe: correlated subselect Pin
Smithers-Jones4-Nov-08 9:24
Smithers-Jones4-Nov-08 9:24 
AnswerRe: correlated subselect Pin
SomeGuyThatIsMe4-Nov-08 7:28
SomeGuyThatIsMe4-Nov-08 7:28 
GeneralRe: correlated subselect Pin
Smithers-Jones4-Nov-08 8:25
Smithers-Jones4-Nov-08 8:25 
GeneralRe: correlated subselect Pin
SomeGuyThatIsMe4-Nov-08 8:31
SomeGuyThatIsMe4-Nov-08 8:31 
GeneralRe: correlated subselect Pin
Smithers-Jones4-Nov-08 8:52
Smithers-Jones4-Nov-08 8:52 
GeneralRe: correlated subselect Pin
SomeGuyThatIsMe4-Nov-08 9:39
SomeGuyThatIsMe4-Nov-08 9:39 
GeneralRe: correlated subselect Pin
Smithers-Jones5-Nov-08 0:43
Smithers-Jones5-Nov-08 0:43 
JokeRe: correlated subselect Pin
Smithers-Jones5-Nov-08 0:37
Smithers-Jones5-Nov-08 0:37 
Okay, since none of the solutions proposed above worked for me, I came up with something different.
This one's working fine:

SELECT s1.NameID, s1.LocationID, s1.ColDate
FROM myTable s1
LEFT JOIN myTable s2 ON s1.NameID= s2.NameID AND s1.ColDate < s2.ColDate
WHERE s2.NameID IS NULL

Returns for every NameID only the LocationID with the most actual date, exactly as desired.


Thanks to Mika Wendelius, Blue_Boy and SomeGuyThatIsMe for their answers and the time they spent trying to solve my problem. Rose | [Rose]



GeneralRe: correlated subselect Pin
PIEBALDconsult5-Nov-08 14:39
mvePIEBALDconsult5-Nov-08 14:39 
QuestionOpinion on how to handle a DataSet Pin
stormydaniels4-Nov-08 0:05
stormydaniels4-Nov-08 0:05 
AnswerRe: Opinion on how to handle a DataSet Pin
Wendelius4-Nov-08 4:53
mentorWendelius4-Nov-08 4:53 
QuestionConfigure Auto Database Replication Problem Using Sql Server 2000 Pin
veereshIndia3-Nov-08 18:55
veereshIndia3-Nov-08 18:55 
AnswerRe: Configure Auto Database Replication Problem Using Sql Server 2000 Pin
Wendelius4-Nov-08 5:05
mentorWendelius4-Nov-08 5:05 
QuestionDebugging a stored procedure Pin
dptalt3-Nov-08 10:29
dptalt3-Nov-08 10:29 
AnswerThis doesn't answer your question Pin
Ennis Ray Lynch, Jr.4-Nov-08 4:30
Ennis Ray Lynch, Jr.4-Nov-08 4:30 
AnswerRe: Debugging a stored procedure Pin
Wendelius4-Nov-08 5:18
mentorWendelius4-Nov-08 5:18 
QuestionCTE to Build XML Pin
Michael Vivet3-Nov-08 1:51
Michael Vivet3-Nov-08 1:51 
AnswerRe: CTE to Build XML Pin
Wendelius4-Nov-08 6:58
mentorWendelius4-Nov-08 6:58 
GeneralRe: CTE to Build XML Pin
Michael Vivet5-Nov-08 1:43
Michael Vivet5-Nov-08 1:43 
GeneralRe: CTE to Build XML Pin
Wendelius5-Nov-08 9:57
mentorWendelius5-Nov-08 9:57 
GeneralRe: CTE to Build XML Pin
Michael Vivet6-Nov-08 23:32
Michael Vivet6-Nov-08 23:32 
GeneralRe: CTE to Build XML Pin
Wendelius7-Nov-08 6:59
mentorWendelius7-Nov-08 6:59 
QuestionCheck if a table is empty Pin
ONeil Tomlinson2-Nov-08 22:36
ONeil Tomlinson2-Nov-08 22:36 
AnswerRe: Check if a table is empty Pin
Ashfield2-Nov-08 22:49
Ashfield2-Nov-08 22:49 
GeneralRe: Check if a table is empty Pin
SomeGuyThatIsMe4-Nov-08 7:46
SomeGuyThatIsMe4-Nov-08 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.