All pastes #835276 Raw Edit

Anonymous

public text v1 · immutable
#835276 ·published 2007-12-28 20:02 UTC
rendered paste body
I have entries in a table as follows.


mysql> select name,sid,showclickable from mybb_smilies;
+--------------------+-----+---------------+
| name               | sid | showclickable |
+--------------------+-----+---------------+
| Very Happy         |   1 | no            |
| Very Happy         |   2 | no            |
| Very Happy         |   3 | no            |
| Smile              |   4 | no            |
| Smile              |   5 | no            |
| Smile              |   6 | no            |
| Sad                |   7 | no            |
| Sad                |   8 | no            |
| Sad                |   9 | no            |
| Surprised          |  10 | no            |
| Surprised          |  11 | no            |
| Surprised          |  12 | no            |
| Confused           |  13 | no            |
| Confused           |  14 | no            |
| Cool               |  15 | no            |
| Cool               |  16 | no            |
| Cool               |  17 | no            |
| Laughing           |  18 | no            |
| Mad                |  19 | no            |

What I need to do is have just one of each 'name' to have 'showclickable' set to 'yes'.

For example

mysql> select name,sid,showclickable from mybb_smilies;
+--------------------+-----+---------------+
| name               | sid | showclickable |
+--------------------+-----+---------------+
| Very Happy         |   1 | yes           |
| Very Happy         |   2 | no            |
| Very Happy         |   3 | no            |
| Smile              |   4 | yes           |
| Smile              |   5 | no            |
| Smile              |   6 | no            |
| Cool               |  15 | yes           |
| Cool               |  16 | no            |
| Cool               |  17 | no            |
| Laughing           |  18 | yes           |
| Mad                |  19 | yes           |

I'd be very appreciative if someone could give me an SQL query that'd do that.
Thanks