mercredi 22 avril 2015

SQL sort based on comma-separated string?

Say that I have a table that looks like this (sorry about using a picture, but I can't figure out how to get a nicely-formatted table on SO...):

Recipes and Ingredients

I wanted to make a query to sort the ingredients by the frequency of recipes they appear in. So in this example, we'd want to see the following output:

Sorted ingredients

I was thinking that LIKE and IN might be potentially helpful to make this search, but I'm not sure how to go from there.

Aucun commentaire:

Enregistrer un commentaire