Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Group by, how to get individual data without grouping on it?

$
0
0

I have joined the job history tables creating a table with server_name varchar(25),  job_name varchar(25) , time_of_execution datetime , duration int. There are about 20 servers and each server can have any number of jobs.

I want to generate a list with 1 row per server  showing server_name, job_name, time_of_execution and duration for the job that was run most recently on that server.

I know I can group on server_name to get 1 row per server and I Know Max(time_time _execution) will give me the most recently run job; but, how do I get job_name and duration?


Viewing all articles
Browse latest Browse all 23857

Trending Articles