How to write the sql query to fetch parent key and it's associated key's : Table 1:

MBR_KEY RCD SID
AAA     18  12
BBB     19  12
CCC     18  13

SCENARIOS: 
WHEN RCD=18 THEN MBR_KEY AS SKEY 
WHEN RCD<>18 THEN CHECK SID'S ARE SAME AS PARENT MBR_KEY(RCD 18 IS CONSIDERED AS PARENT MBR_KEY)

O/P be like: 
mbr_key skey
aaa     aaa
bbb     aaa
ccc     ccc
 