我想限制以下查询产生的短语数量:
SELECT phrase_txt, word_txt FROM phrase_word
LEFT JOIN phrase ON phrase.id = phrase_word.phrase_id
LEFT JOIN word ON word.id = phrase_word.word_id;
| PHRASE_TXT | WORD_TXT |
-------------------------
| Iambad | i |
| Iambad | am |
| Iambad | bad |
| Car | car |
| tellme | tell |
| tellme | me |
预期输出:
| PHRASE_TXT | WORD_TXT |
-------------------------
| Iambad | i |
| Iambad | am |
| Iambad | bad |
| Car | car |
添加LIMIT 0,2没有帮助,因为它限制了单词的数量,而不是短语的数量。假设2:
| PHRASE_TXT | WORD_TXT |
-------------------------
| Iambad | i |
| Iambad | am |
此SQL Fiddle中的更多详细信息。