sql - MySQL Show best match between two tables -


i have challenge in mysql, i'm complete rookie on subject really, here goes.

i'm trying make application lets user input ingredients have @ home, , give response recipes user make.

i have 2 tables.

recipe id - name - description

and

ingre id - name

so far sql looking this:

create temporary table temptable(     id int( 3 ) not null auto_increment primary key,        searchword varchar( 255 )     );  insert temptable( searchword ) values ('carrot'),('potato');  select * ingre, temptable     ingre.name concat('%', temptable.searchword, '%'); 

my idea make count recipe table see how many ingredients specific recipe requires , response make list of "best matches".

to more clear:

if recipe example above requires 1 carrot, 1 potato , 1 onion, know fulfill 66% of recipe, , result should shown above recipe requires 1 carrot, 1 potato, 1 onion , 1 apple.

do guys have idea how should proceed this?

kind regards,


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -