Results 1 to 4 of 4

Thread: having count

  1. #1
    Join Date
    Jan 2004
    Location
    ny
    Posts
    16

    Unhappy Unanswered: having count

    Hello ,
    I would probably need a correction

    I have a report:
    that will return all customer packages with type 5
    where the amount of PTA types in the P table
    is greater then the number
    in the M table with type of 1.

    I done this...but not sure if corect
    Thank you

    select c.c_ix , count(*)
    from c , p , p p_1
    where c.ctype = '5'
    AND c.c_ix = p.SC_iX
    AND p.ptype='PTR'
    AND p.SC_iX = p_1.SC_iX
    AND p_1.ptype='PTA'
    group by c.c_ix
    having count(*) >
    ( select count(*)
    from m
    where m.c_ix = c.c_ix
    and m.mtype = '131' )

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    looks good to me.
    do you get an error?
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jan 2004
    Location
    ny
    Posts
    16
    Originally posted by The_Duck
    looks good to me.
    do you get an error?
    no, i did not only not sure if the coubt is correct , got so many back

  4. #4
    Join Date
    Jul 2003
    Posts
    2,296
    know your data.
    You know better than I would.

    run some test queries to verify the output
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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