select - PHP QUERY Loop? -


basically have genealogy table has child_id , parent_id (both of fields in table). goal add + 1 vote field each parent in lineage.

so, need select parent_id row , update vote. need select parent row , update parents vote. need select parent row , same thing..over , on until first ancestor , there no more parents or children update. here select , update queries:

select parent_id profiles child_id = $first_ancestor update profiles set votes = votes + 1 child_id = parent_id 

do use loop? or how do this? thanks!

i'd use loop. knowledge, that's limitation relational databases. dbms have better support recursive queries others though.

if you're it, might want check out called graph databases. of them has better support these kinds of operations relational databases have.

check out:


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -