count row after select statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mixupatel
    New Member
    • Dec 2012
    • 3

    count row after select statement

    Code:
    SELECT attnddate, COUNT(1)as v_cnt    FROM inouttime where empcode='1' and to_date(attnddate,'DD-MM-YYYY') between to_date('01-01-2011','DD-MM-YYYY') and to_date('07-01-2011','DD-MM-YYYY')
       group by attnddate;
    output:-
    Code:
    ATTNDDATE V_CNT 
    02-01-2011 2 
    03-01-2011 1 
    01-01-2011 3
    hey this is my query and now i want to count the row of v_cnt so plz help me
    Last edited by zmbd; Jan 1 '13, 10:05 PM. Reason: [Z{Please use the <CODE/> button to format posted code/html/sql}]
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    I think you mean you want to count the number of rows (records). Use a subquery
    Code:
    SELECT COUNT(v_cnt) FROM(
    SELECT attnddate, COUNT(1)as v_cnt    FROM inouttime where empcode='1' and to_date(attnddate,'DD-MM-YYYY') between to_date('01-01-2011','DD-MM-YYYY') and to_date('07-01-2011','DD-MM-YYYY')
       group by attnddate)sq

    Comment

    Working...