Sql Expression Field (1 Viewer)

gfultz

Registered User.
Local time
Today, 08:14
Joined
Dec 18, 2009
Messages
51
I have a query in which I want to pull the latest entry from another query. No matter how I have sliced it, it returns the latest for all records regardless of the mrid. Here is the code...

Code:
(Select Top 1 Expr1 FROM NOTEMERGE WHERE NOTEMERGE.MRID = [MRID])

The NOTEMERGE query grabs all of the notes with a certain flag and then concatenates 3 fields (Date, author, and note) and is sorting in descending order by dt. I just want this field to display the concatenated field for the latest note for that particular MRID. MRID exists on both queries.

The result I get:
MRID Expr1
1 12/23/2009 - note
12 12/23/2009 - note

What I want
MRID Expr1
1 12/18/2009 - notes
12 12/23/2009 - note

I believe the breakdown occurs in the WHERE clause...
 

gfultz

Registered User.
Local time
Today, 08:14
Joined
Dec 18, 2009
Messages
51
Nice! Your article was perfect. Thanks!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:14
Joined
Aug 30, 2003
Messages
36,132
No problem, glad it helped.
 

Users who are viewing this thread

Top Bottom