options_table
options_id    | object_id  |   option_value
=========================================
1            |    1       |    drink
2            |    2       |    ice
3            |    1       |    bath
4            |    2       |    soda
5            |    2       |    drink
6            |    3       |    ice
7            |    4       |    bath
8            |    2       |    bath
9            |    1       |    storm
object_table
object_id    |   object_name
=============================
1            |    sun
2            |    moon
3            |    mars
4            |    jupiter
クエリ
SELECT object_table.object_name GROUP_CONCAT(options_table.option_value ) as object_options 
FROM options_table
LEFT JOIN object_table
ON object_table.object_id = options_table.object_id    
GROUP BY options_table.object_id
だから私は次のような結果を得る
object_name | object_options
=========================================
moon        | ice, soda, drink, bath
sun         | drink, bath, storm
mars        | ice
jupiter     | bath
ユーザーがオプション "drink" とオプション "bath" を持つすべてのオブジェクトを必要としているとします。だから私はこの結果しか得られません。
object_name | object_options
=========================================
moon        | ice, soda, drink, bath
sun         | drink, bath, storm
この結果を得るには、クエリをどのように編集する必要がありますか?