Avatar of dgrafx
dgrafxFlag for United States of America

asked on 

Query help

I have table_one
id(int), name(varchar)

example recordset from table_one
1000 Testone
1001 Testtwo
1002 Testthree

joined on table_two
id(int), sdate(date), edate(date)

example recordset from table_two
1000 01/12/2019     02/15/2019
1000 02/16/2019     03/15/2019
1000 03/16/2019     04/19/2019
1002 01/16/2019     02/13/2019
1002 02/14/2019     04/17/2019

This is a one to many relationship with table_one being primary
I want to select only one row from table_two that has the latest edate value

So result set of desired query would be

1000 Testone 03/16/2019     04/19/2019
1002 Testthree   02/14/2019     04/17/2019

Thanks
Microsoft SQL Server

Avatar of undefined
Last Comment
dgrafx
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of dgrafx
dgrafx
Flag of United States of America image

ASKER

Hold on a minute - I'm having some issues ...
Will post back in a bit
Avatar of dgrafx
dgrafx
Flag of United States of America image

ASKER

OK works great Scott!
Thanks!
Avatar of dgrafx
dgrafx
Flag of United States of America image

ASKER

!
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo