troubleshooting Question

All fields from MS SQL table A and only the top from tableB

Avatar of Steynsk
SteynskFlag for Netherlands asked on
Microsoft SQL ServerSQL
4 Comments1 Solution386 ViewsLast Modified:
Hi Experts,

My MS SQL tables A and B have one to many relation. One entry in table A can have multiple related entries in table B.

With the query below I get a list of records so that works.

Select A.accountname, B.actiondate from B inner join A on A.account=B.account

The output is like:

accountname      actieondate
JohnD      2013-2-12
JohnD      2013-2-16
JohnD      2013-3-24
MaryC      2013-5-24
GeorgeB      2013-3-11
GeorgeB      2013-6-21


But I would like to get only the latest action dates only like in the output example below

accountname      actieondate
JohnD      2013-3-24
MaryC      2013-5-24
GeorgeB      2013-6-21
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros