count record with same value of field1 with field2 are also same value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rjlorenzo
    New Member
    • Oct 2008
    • 16

    count record with same value of field1 with field2 are also same value

    Good Day

    Just wanted to ask for any help on how could I count a record depending on the value of the two column. Example below table i need to count the productivity of the agent for march 1 for each telno and for march 2 for each number.
    the rule is 1 productivity per telno per day. Even they encoded many data for same telno still it count 1.

    SQL = SELECT ACTION_DATE, COUNT(DISTINCT ACTION_RECNO) FROM WEB_ACTIONDETAI LSDONE WHERE ACTION_USER like '%" & sagent & "%' AND ACTION_DATE BETWEEN #" & fdate & "# and #" & tdate & "# GROUP BY ACTION_DATE;"


    telno date user
    111 1-Mar agent 1
    222 1-Mar agent 1
    333 1-Mar agent 1
    111 1-Mar agent 1
    333 1-Mar agent 1
    222 2-Mar agent 1
    444 2-Mar agent 1
    444 2-Mar agent 1
    111 2-Mar agent 1
    333 2-Mar agent 1

    the result should be
    march 1
    agent - 3

    march 2
    agent - 4

    thank you in advance

    RJ
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    This is a database question, not an ASP question. please tell me what type of db it is, and I will put it in the correct forum (access, SQL Server, MySQL, Oracle, etc).

    Jared

    Comment

    Working...