-
-
Save jezinka/9fc0c06c8bb6b1a070f7c685ff1051e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getShoppingListQuery(List<Meal> meals) { | |
StringBuffer sb = new StringBuffer(); | |
sb.append("select name, count(name) from ("); | |
for (int i = 0; i < meals.size(); i++) { | |
sb.append(getIngredientsQuery()); | |
if (i < meals.size() - 1) { | |
sb.append(" union all "); | |
} | |
} | |
sb.append(") group by name order by name collate nocase;"); | |
return sb.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment