diff --git a/dbs/children.go b/dbs/children.go index 6b47079..2431495 100644 --- a/dbs/children.go +++ b/dbs/children.go @@ -19,6 +19,11 @@ func (a *API) GetChild() error { if err != nil { return Error(err, LoadErrorCode, "", "dbs.children.GetChild") } + if val, ok := a.Params["did"]; ok { + if val != "" { + conds, args = AddParam("did", "PDS.did", a.Params, conds, args) + } + } stm = WhereClause(stm, conds) diff --git a/static/sql/select_child.sql b/static/sql/select_child.sql new file mode 100644 index 0000000..5ee3dab --- /dev/null +++ b/static/sql/select_child.sql @@ -0,0 +1,6 @@ +SELECT + D.did CHILD_DID, + PDS.did +FROM DATASETS D +LEFT OUTER JOIN PARENTS DSP ON DSP.DATASET_ID = D.DATASET_ID +LEFT OUTER JOIN DATASETS PDS ON PDS.DATASET_ID = DSP.PARENT_ID