SQL Server 2000General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
i have 2 tables TaskMaster and TaskDetails....
Taskdetails has multiple records for a particular task....
I need to select all the records from taskmaster and corresponding record which is the latest from taskdetails....
for eg if TaskMaster has following records
TaskNumber SysCode TaskDescription DateRecieved ClientContact
2456 HA Task4 4/20/2005 Doreen
4057 HA Task1 3/3/2002 Steve
and TaskDetails has
TaskNumber CurrentDate Efforts Per Comments
Spent Completed
2456 1/1/2004 6 56 On-Hold Coding try1
4057 1/1/2003 56 56 On-Hold Analys
4057 1/1/2004 34 34 Active Coding not
4057 1/1/2005 45 45 Active Analysi
4057 1/1/2006 67 67 Active Coding try5
2456 5/20/2005 8 50 Active Coding trial
4057 5/20/2005 55 45 Completed
I need only the latest record for task num 4057 and 2456...i.e Max(CurrentDate) plus all the columns from TaskMaster also
select A.*, b.* from TaskMaster a, TaskDetails b where a.TaskNumber = b.TaskNumber and b.CurrentDate in (select max(CurrentDate) from TaskDetails group by TaskNumber)
Regards,
Jayahar Aruchamy.
Life is all about expecting the unexpected.