Script Report Fetch Data From Child Table

Hello Community,

I have created few script reports. And also written custom script for all. Now i have to fetch data from child table from particular parent doctype. Like i want to fetch data from child table on some condition validate for it’s parent doctype, then how can i separate out this.

Currently i am fetching child table data from database, but it will return all data from this child table. I want only data from 1 parent doctype.

Any help will be appreciable. :slight_smile:

Thanks,
Hardik Gadesha

you can use join clause in your sql query

Thanks @SOLOSOFT for your reply.

Child table database return all values. and i want only selected form values.
For E.g i have 2 doctypes :
1) Students
2) Students Mark-sheet

In Student doctype, i will enter student details like, first name, last name, std, class etc.
In Students Mark-sheet doctype, i have student name as parent field and 1 child table with column maths, science, computer, english etc.Now if i select any student name in script report than it should return grades of that student only, not the all values entered in this child table.

Could you explain me how to do this ?

Thanks,
Hardik Gadesha

1 Like

Hello Hardik,
Incase you have not solved this yet, I found a solution for a similar situation that I came across.
My parent table had ‘branch’ and ‘month’ and my child table had a ‘day1’,‘day2’,etc with some value. And for the report the query i used is
“”" SELECT A.col1,A.col2,B.colA,B.colB FROM parent_table as A INNER JOIN child_table AS B ON A.name=B.parent"“”