troubleshooting Question

SQL query to find max date and and corresponding field

Avatar of Pharmica
PharmicaFlag for Afghanistan asked on
Microsoft SQL Server 2005SQL
15 Comments2 Solutions545 ViewsLast Modified:
Greetings Experts,

I need some help with a query.  Here is an example of what I am looking to do.

Table 1                           Table2
ColA                                ColA             ColB             ColC
Group1                           Group1       01/01/08         Screening
Group2                           Group1       02/01/08         Closout
Group3                           Group1       03/01/08         Initiation

The first table has unique groups.  The second table has many so I guess this is one to many.
The resulting table I need will show each group (ie group1) with max date and its corresponding ColC value.

So It would look like this
ColA              ColB            ColC
Group1         03/01/08     Initiation

Can anyone help with this?  I got as far as being able to detemine the maxdate (colB) but when I try to add ColC I get way too many records.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 15 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 2 Answers and 15 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