I am not sure if this can be done purely with SQL, or it will require a perl loop. I am guessing straight SQL is the better performace option.
I have the function (which you helped me write two posts ago):
#determine if the category has children
sub has_children { $DB->table('Category')->count( { FatherID => $_[0] } ) }
and I want to go through every record in Category, run the "ID" through my function: has_children($category_id), and if it returns true, SET Category.haschildren = "Yes" ELSE set "No".
UPDATE 'Category' SET 'haschildren' = 'Yes' WHERE has_children('ID') <- my bad attempt
http://www.iuni.com/...tware/web/index.html
Links Plugins
I have the function (which you helped me write two posts ago):
#determine if the category has children
sub has_children { $DB->table('Category')->count( { FatherID => $_[0] } ) }
and I want to go through every record in Category, run the "ID" through my function: has_children($category_id), and if it returns true, SET Category.haschildren = "Yes" ELSE set "No".
UPDATE 'Category' SET 'haschildren' = 'Yes' WHERE has_children('ID') <- my bad attempt
http://www.iuni.com/...tware/web/index.html
Links Plugins