Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    9

    Unhappy Unanswered: return a record depends of group result

    Hi

    I have a table with records like that.

    Group | Value
    Team 1 | 0
    Team 1 | 0
    Team 1 | 1
    Team 1 | 1
    Team 2 | 0
    Team 2 | 0
    Team 2 | 0

    I want a script that return 0 if all the values of the group are 0 and return 1 if the records of the value is mixed with 0 and 1.

    Is that possible?

    Please help.

    Thank you.

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Code:
    select a.[Group], SummaryValue = case when exists (select * from a_table a1 where a.[Group] = a1.[Group] and a1.Value != 0) then 1 else 0 end
    from a_table a group by a.[Group]
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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