Simplified example of a problem I am trying to solve:

**EDIT - With PK**

sqlfiddle: <http://sqlfiddle.com/#!2/7be5d/1>

**---**

I have two tables:

```
People
--------
| Name |
--------
| Mike |
| Jim  |
| Fred |
--------

HasBanana
------------------------
| Name  | Has_a_banana |
------------------------
| Mike  | N            |
| Mike  | N            |
| Mike  | N            |
| Mike  | N            |
| Mike  | Y            |
| Mike  | N            |
| Jim   | N            |
| Jim   | N            |
| Jim   | Y            |
| Jim   | N            |
| Jim   | N            |
| Fred  | N            |
| Fred  | N            |
| Fred  | N            |
| Fred  | N            |
| Fred  | N            |
| Fred  | N            |
------------------------

```

And a query:

```
select * from People
left join HasBanana on HasBanana.name = People.name;

```

This produces a table exactly the same as the HasBanana table above. What I would like to produce is a table grouped by People.name and showing Y if the person has ever been marked as having a banana.

So something like this:

```
HadBanana
------------------------
| Name  | Had_a_banana |
------------------------
| Mike  | Y            |
| Jim   | Y            |
| Fred  | N            |
------------------------

```

I know I can use the following to group by name

```
group by people.name;

```

but having issues doing the logic to say for each name if has\_a\_banana has ever been Y then set had\_a\_banana to Y.