Imagine that I have these Table
Name Type JobName Desc
first SMARt first the main first
first SufFold second the second, depend on first
I need to generate, all subfold but including description of their name that like you see is in another row.
Name JobName Desc Desc2
first second the main fisrt the second, depend on first
I'm trying with iner join of the same table but I have a lot of duplicates. Anyone could help me plese? Thanks!
CodePudding user response:
You should join the same table to connect parent with children, and then display description from two (same) tables. Since you gave no informations about how tables are connected i wrote example of pseudo code how it could look like:
SELECT t1.name
,t1.jobName
,t1.Desc
,tChild.Desc as Desc2
FROM table1 t1
JOIN table1 tChild on t1.id=tChild.parent_id