hi needed help in a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raam
    New Member
    • Jun 2008
    • 11

    hi needed help in a query

    hi iam raam


    select count(*) as [No of Callers] from
    (select empcode,empname ,count(*) as [No of Calls],convert(varcha r(10),details.L ogintime ,101) as Date
    from details join employee on employee.empid = details.empcode
    where employee.Permis sion <> '1' and details.Loginti me between '06/10/2006' and '06/11/2006'
    group by empcode,empname , convert(varchar (10),details.Lo gintime ,101))e



    i have this query to get count of callers.But i want date wise count of callers from table name status details.
    just like this

    date No of callers
    06/07/2006 45
    06/07/2007 50


    can any one help me
    thanks
  • LiLMsNinja
    New Member
    • Jun 2008
    • 3

    #2
    You should only have to group by date to get the results you want.

    Comment

    • raam
      New Member
      • Jun 2008
      • 11

      #3
      Originally posted by LiLMsNinja
      You should only have to group by date to get the results you want.
      ya i have done it.but no result as such a way.

      Comment

      • LiLMsNinja
        New Member
        • Jun 2008
        • 3

        #4
        Code:
        SELECT DETAILID, COUNT(*) "NUMBER OF CALLERS" FROM DETAILS
        WHERE LOGINTIME BETWEEN '10-JUN-2008' AND '12-JUN-2008' AND
        EMPID IN
        (SELECT EMPID FROM EMPLOYEE)
        GROUP BY 1

        That's closer to what you need. You don't need to select empcode, empname and stuff. Change detailid for a column that can be grouped. I believe i need to see a sample table structure and better detail.

        Comment

        Working...