Solved

Select Top -- Order By SQL Servef

Posted on 2009-07-14
1
153 Views
Last Modified: 2012-05-07
Hello Expert. May I please have some assistance? I would like to do a select and retrieve one row. I would like to have the most recent modified date to be returned. This Table has multiple rows for the same client id. But the client id is my trigger for returning records.

Thanks for you assistance.
0
Comment
Question by:lemarge
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24849982
select ClientID, MAX(ModifiedDate) modifiedDate
from urTable
GROUP BY ClientID

--to get the most recent record
SELECT * FROM urTable WHERE ModifieDate = (SELECT MAX(ModifiedDate) from urTable )
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now