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
Post a Comment