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
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.
modified 19-Apr-12 4:26am.
Last Visit: 31-Dec-99 19:00 Last Update: 8-Dec-16 12:22