Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    7

    Unanswered: Select count statement - urgent plzzzz

    Hi,

    I am trying to count the occurences of certain data according to their dates.

    let's say the table is like

    Date1 Date2 colour country
    =====\\=====\\=====\\=======
    02/05/08 04/05/08 blue UK
    ...

    I would like to get from this table the number of occurences of date1=sysdate -1 and a another colum with occurences of date2=sysdate-1 and a 3rd column where date1=sysdate-1 and date2=sysdate-1.

    so output would be something like

    Date1 Date2 date1anddate2
    5 10 3

    I hope i have been clear.
    Many thanks for your help.
    Regards

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Something like this Scott's schema example?
    Code:
    SQL> select t1.cnt, t2.cnt
      2  from (select count(*) cnt
      3        from emp
      4        where to_char(hiredate, 'yyyy') = '1981'
      5       ) t1,
      6       (select count(*) cnt
      7        from emp
      8        where to_char(hiredate, 'yyyy') = '1982'
      9       ) t2;
    
           CNT        CNT
    ---------- ----------
            10          2
    
    SQL>

  3. #3
    Join Date
    Nov 2008
    Posts
    7

    Thats exactly what I wanted!

    Thanks a lot mate !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •