Get the value of field in child table

As we know that in salary slip, there is deduction table.
Inside the deduction table, there are salary components (of deduction type).
One of these salary components is Income Tax.
Also in the deduction table, there is Amount field which is the amount of the deduction component.
From python:
How I can get the value of the Amount for the Income Tax deduction component in this deduction table in the salary slip?
Is it using frappe.db.sql or there is a method that let me get the fields values of the child table records?
Appreciate the kindly help.

There is no specific method for fetching child table fields.

You can use

frappe.db.get_value() - to fetch single field.

frappe.db.get_values() - to fetch multiple field.

frappe.get_doc() - to fetch whole record.

Thanks a lot for your kindly reply and help.
I tried frappe.db.get_value and it is not able to see any field in child table.
Below is picture of the document and I selected the required filed to be fetched from salary slip document.
I need to fetch from the child table “deductions” the amount filed value of the Income Tax component field in the salary slip parent document.
From the other side, there is not any method to fetch the child table based on its parent table?
In my case, the child table is deductions and the parent table is salary slip.


@bghayad have you solved this? if yes, then please can you describe how?