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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Traking Offence

Traking Offence

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
3 Posts 2 Posters 2 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
    Billa2
    wrote on last edited by
    #1

    I have a table called tbloffence where we can see list of offence which workers have done in worksite.so now i want to display the sumtotal of their offence in .aspx page based on workes userid,but the condition is like this: a) offence since last login: b)offence in last 1 month. i want to write a sql query based on this condition...how can i track"offence since last login"in sql server 2005

    M 1 Reply Last reply
    0
    • B Billa2

      I have a table called tbloffence where we can see list of offence which workers have done in worksite.so now i want to display the sumtotal of their offence in .aspx page based on workes userid,but the condition is like this: a) offence since last login: b)offence in last 1 month. i want to write a sql query based on this condition...how can i track"offence since last login"in sql server 2005

      M Offline
      M Offline
      Mohibur Rashid
      wrote on last edited by
      #2

      This is not an specific question. To get better answer, I would suggest you to generalize the question and provide more information. Anyway This is a very simple problem if I did understand properly. All you need is to record log in time. that is everytime user log in the user. And you would have to work in two different Query or may be in Procedeure, where you would send the user_id and procedure will return the result.

      B 1 Reply Last reply
      0
      • M Mohibur Rashid

        This is not an specific question. To get better answer, I would suggest you to generalize the question and provide more information. Anyway This is a very simple problem if I did understand properly. All you need is to record log in time. that is everytime user log in the user. And you would have to work in two different Query or may be in Procedeure, where you would send the user_id and procedure will return the result.

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

        Actually i want to workin 3 tables 1)tbloffence : where we will get the sum(offence) here i track maincontractorID and sum(offence) query will be like this : "SELECT sum(o.OffenceID) as OffenceNumber,u.UserID from tblOffence o inner join tblSubContractor ts on o.MainContractorID=ts.SubContractorID" from here i will chk the tblUSER with these subcontractorID : "inner join tblUser u on u.SubContractorID=ts.SubContractorID" . and my doubt is that upto here i will get the total sum of offence and appropriate userid.,for eg UserID : 520 TotalOffence:6000 but there is another table called tblAuditTrailSession where we will get logondate and userid which is tracking here..so i want to display offence based on userlogin(userid) ..since last login. i want a help in query format..Hope this is a generalized format question.

        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