Skip to Main Content

MySQL Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

need sql query

0614Feb 7 2017 — edited Feb 7 2017

hi,

im doing calculation in hierarchical way below are my details

CREATE TABLE `nodes_1` (

`parent` int(11) DEFAULT NULL,

`child` int(11) DEFAULT NULL,

`marks` int(11) DEFAULT NULL

)

data:-

pastedImage_0.png

in a query if i pass 5 as parent that calculate 2,3 child marks

and the same if i pass 15 as parent that should calculate 10,5 marks --5 already having 2,3 child. Result would be 200

same if i pass most parent 38 it should calculate 15,17,6 child marks --15 already holding 200 marks ,17 has two childs 9,8 marks ,6 no marks --result 230 e.t.c

thanks in advance.

Comments
Post Details
Added on Feb 7 2017
2 comments
395 views