Table structure
sl_ no A B TOTAL
1 DUDE SAM 5
4 COOL DUDE 8
6 KEWL COOL 8
8 ROCK KEWL 10
How to fetch the value if i give SAM it should be able to fetch the TOTAL of DUDE which is in column B
eg:
SAM =DUDE
DUDE=COOL
COOL=KEWL
KEWL=ROCK
OUTPUT IF I GIVE SAM IT SHOULD FETCH THE DUDE TOTAL=8
If I understand your question here’s the request you need:
You join your table on itself using the columns A and B, and then select the total of the outer table you joined.