Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Get the cell info for Top 1 sql query.

$
0
0

Hello All,

I have a query which works fine for a static data. 

Select Top 1 Machinenames from  AdminTable where datediff(d,actionbyDate, Getdate()) >2 .

Below is the sample data

DurationMachineNamesActionByDate
20Test120/3/2016
30Test210/3/2016
2Test320/3/2016
10Test424/3/2016

The Problem is I am not able to handle the duration . The value should be from the Duration cell against the top 1 which is Random. 

If there is any other way to achive this pls let me know. 

Regards


Priyabrata


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>