All pastes #497915 Raw Edit

kuruption

public text v1 · immutable
·published 2007-05-20 03:38 UTC
rendered paste body
mysql> select * from indexes;
+----+--------+---------+
| id | object | string  |
+----+--------+---------+
|  1 |      2 | honest  | 
|  2 |      2 | dares   | 
|  3 |      2 | paine   | 
|  4 |      2 | thomas  | 
|  5 |      3 | propose | 
|  6 |      3 | toilet  | 
|  7 |      3 | paper   | 
+----+--------+---------+
7 rows in set (0.00 sec)

mysql> select count(string) as count, object, group_concat(string) as matches from indexes where string = 'honest' OR string = 'dares' OR string = 'paper' OR string = 'toilet' OR string = 'thomas' group by object order by count desc;
+-------+--------+---------------------+
| count | object | matches             |
+-------+--------+---------------------+
|     3 |      2 | dares,honest,thomas | 
|     2 |      3 | paper,toilet        | 
+-------+--------+---------------------+
2 rows in set (0.00 sec)