ID category name
(1) "1"
(2) "1"
(3) "1"
(4) "4"
(5) "2"
(6) "3"
(7) "5"
(8) "4"
(9) "6"
(10) "7"
(11) "9"
I have the above data in myTable.
It has three fields and eleven records at the moment.
record (1) has the category value "1".
record (2) also has the category value "1".
record (3) also has the category value "1".
record (4) has the category value "4". this record hasn't any relation with the category value "1".
record (5) has the category value "2". Since the value "2" is the name of record (2) which has the category value "1", it has indirect relation with the category value "1".
record (6) has the category value "3". Since the value "3" is the name of record (3) which has the category value "1", it has indirect relation with the category value "1".
record (7) has the category value "5" Since the value "5" is the name of record (5) which has the category value "2" and the category value 2 is the name of record (2) which has the category value "1", it has the second indirect relation with the category value "1".
record (8) has the category value "4". This record hasn't any relation with the category value "1".
record (9) has the category value "6". this record also has the second indirect relation with the category value "1".
record (10) has the category value "7". this record also has the second indirect relation with the category value "1".
record (11) has the category value "9". this record also has the third indirect relation with the category value "1".
I like to select all records which has direct or indirect relation with the category value "1" and update them with the name "AAA".
update myTable
set name='AAA'
where ALL RECORDS WHICH HAS RELATION WITH THE CATEGORY VALUE "1"
Thanks in Anticipation.