sql server - Using group by for a SQL to filter with datetime -


I am trying to create a SQL but it is not working.

I have a table that:

Amount of Acess | Was the computer ace? | Whats date and time 11 Computers 1 2013-12-30 09:00:00 2 Computer 2 2013-12-30 10:00:00 30 Computer 2 2013-12-30 10: 11:00 17 Computer 3 2013-12-30 17:30:00 200 Computer 4 2013-12-30 07:00:00 150 Computer 1 2013-12-30 14:00:00 19 Computer 1 2013-12-30 06:00:00

What I have to do is the result, where it has been shown to me only this way: In each computer, maximum excise and how much time was there? Result of the OS above the OS will be like this:

Amount of Acess | Was the computer ace? | Whats date and time

  30 computer 2 2013-12-30 10:11:00 17 computer 3 2013-12-30 17:30:00 200 computer 4 2013-12-30 07: 00:00 150 Computer 1 2013-12-30 14:00:00   

Computer 2 in the exact time had maximum 30 Aces 2013-12-30 10:00:00 ... .....

The problem is how can I show a great date in each result? Can anyone help?

Thanks

I think you want the date whose maximum number Uses for each computer? You can use row_number in CTE for this. Select CTE (Access, Computer, DT, Line_Number) (segment by computer order based on access to table) rn = 1) * select * RTE = 1 from CTE

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -