Results 1 to 3 of 3

Thread: Help !!!

  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: Help !!!

    Hi,

    I sure hope you can help me - I'm desperate - I am trying to separate
    the t's from the f's and a count of each and a sum by category. What i
    get is two columns one with the category listed once for t and once for f, so the count on these is good, but it is in the same column - Any help is
    greatly appreciated - Thanks Jeanette

    Select c.category_name, Count(p.discontinued)
    From product p
    Join category c On(c.category_id = p.category_id)
    Where p.discontinued = 't'
    Group By c.category_name
    Union
    Select c.category_name, Count(p.discontinued)
    From product p
    Join category c On(c.category_id = p.category_id)
    Where p.discontinued = 'f'
    Group By c.category_name;

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    try something like this ...
    I am sure I could rewrite this better, but for now ...

    PHP Code:
    select distinct
    count_of_t
    ,
    category_name_t,
    count_of_p,
    category_name_p
    from 
    (
    (
    select count(*) over (c.category_namecount_of_t,
     
    c.category_name category_name_t
    from 
    product p
    category c
    where c
    .category_id p.category_id
    and p.discontinued 't'a,
    (
    select count(*) over (c.category_namecount_of_p,
     
    c.category_name category_name_p
    from 
    product p
    category c
    where c
    .category_id p.category_id
    and p.discontinued 'p')) 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Mar 2004
    Posts
    4
    Hey DUCK thanx much, I shall let you know if that works...

Posting Permissions

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