On 1/6/2011 6:11 PM, gasperhafner wrote: > ID_dish | ID_ingredient > 1 | 355 > 1 | 390 > 1 | 217 > 1 | 23 > 1 | 261 > 2 | 92 > 2 | 377 > 2 | 23 > 2 | 365 > > i have ingredients with ID_ingredient (355, 390, 217, 23, 261) > with query i have to get: > > ID_dish | missing > 1 | 1
Why? Which ingredient is dish #1 missing? > 2 | 3 > > because in table you can see that dish with id 1 has ingredients with id > (355, 390, 217, 23, 261, 23) You have 23 repeated twice - where is this coming from? > and i have 4/5 of them You have 5 out of 5, as far as I can tell. > on second place is dish > with id 2 with ingredients with id (377, 23, 365) and 92 > and i have 1/3 ingreedients.... 1/4. In any case, let's assume you do in fact have 4 out of 5 for one, and 1 out of 3 for the other. How is the order deremined? Is it literally "four fifths are greater than one third"? Then you can do order by stillMissing * 1.0 / count(*) -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users