mysql - How may I get these values using a query -


i have table called levenstein

with following column names , dataset :

**meal****ingredients****occurence** soup       tomate          4 soup       maggi          100 soup       onions          23 soup       salt           300 soup       pepper         345 lasagne    cheese         234 lasagne    butter         2422 lasagne    beef            42 lasagne    salt            244 . . 

occurrence amount of times user used ingredient soup example, many users used pepper else. thats logic make understand data.

i want query give me used ingredient each meal ingredient name. have :

**meal****ingredients****occurence**     soup       pepper         345       lasagne    butter         2422     .     . 

try

select meal, ingredients, occurence table join (select meal m, max(occurence) max_occurence table group meal) t on table.m = t.meal table.occurence = t.max_occurence 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -