Lets say I have the following table depicting a one-many relationship

```
col1  |  col2
------------- 
1     |  foo
1     |  bar
2     |  foo
3     |  buzz

```

**I need to group by `col1` and I need a boolean indicating whether or not there is *both* a mapping to 'foo' *and* a mapping to 'bar'.**

So, the final result set would be

```
col1 | foobar
-------------
1    |  1
2    |  0
3    |  0

```

What is the best way to achieve this in T-SQL?

I've been trying something roughly equivalent to the following query with no luck. 

```
SELECT

  col1

  , (
    MAX (
      CASE WHEN
        COL2 = 'foo'
      THEN 1 ELSE 0
    END) = 1
    AND
    MAX (
      CASE WHEN
        COL2 = 'bar'
      THEN 1 ELSE 0
    END) = 1
  )           
FROM 
  table
GROUP BY 
  col1

```

---

**EDIT:**

To clarify, this table is a simplification. 

I am looking for a solution to the general problem of having a one-many mapping and needing to produce a new 1-1 mapping with a Boolean indicating if a variable number of predicates are true of the different elements in the groups in the co-domain. (grouped by the fact that the same element maps to them)

Also, I should clarify that these various predicates could be anything. 

For example, maybe I want to see if at least one of the columns in one of the rows = 'foo' and also that a different column in a (possibly different) row within the same group is between a certain set of numeric values.