Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to get latest usage time per pc

how to get latest usage time per pc

Scheduled Pinned Locked Moved Database
questiondatabasetutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    batmanAgen
    wrote on last edited by
    #1

    hi, i have a table softwareMeter(id [primarykey], pcID, softID, myDateTime). what is the query to get the last usage of the software per pc?

    K 1 Reply Last reply
    0
    • B batmanAgen

      hi, i have a table softwareMeter(id [primarykey], pcID, softID, myDateTime). what is the query to get the last usage of the software per pc?

      K Offline
      K Offline
      kageorge
      wrote on last edited by
      #2

      Hi Just have a try with the below code Create Table #softwareMeter(id Int primary key, pcID Int, softID Int, myDateTime DateTime) Insert Into #softwareMeter Values (1,100,501,'20060301 10:12') Insert Into #softwareMeter Values (2,102,509,'20060301 12:40') Insert Into #softwareMeter Values (3,100,503,'20060302 08:12') Insert Into #softwareMeter Values (4,102,508,'20060302 13:50') Insert Into #softwareMeter Values (5,103,508,'20060303 13:50') Insert Into #softwareMeter Values (6,104,509,'20060303 15:20') Insert Into #softwareMeter Values (7,105,503,'20060303 18:13') **select top 10 with ties PCID,max(MyDateTime) from #softwareMeter Group by PCID Order By PCID** The top close is a must and the number after top should be set wisely.

      B 1 Reply Last reply
      0
      • K kageorge

        Hi Just have a try with the below code Create Table #softwareMeter(id Int primary key, pcID Int, softID Int, myDateTime DateTime) Insert Into #softwareMeter Values (1,100,501,'20060301 10:12') Insert Into #softwareMeter Values (2,102,509,'20060301 12:40') Insert Into #softwareMeter Values (3,100,503,'20060302 08:12') Insert Into #softwareMeter Values (4,102,508,'20060302 13:50') Insert Into #softwareMeter Values (5,103,508,'20060303 13:50') Insert Into #softwareMeter Values (6,104,509,'20060303 15:20') Insert Into #softwareMeter Values (7,105,503,'20060303 18:13') **select top 10 with ties PCID,max(MyDateTime) from #softwareMeter Group by PCID Order By PCID** The top close is a must and the number after top should be set wisely.

        B Offline
        B Offline
        batmanAgen
        wrote on last edited by
        #3

        hey thanks for the reply... and for giving me the sql command.. thanks alot..:D i appreciate it!:)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups