cancel
Showing results for 
Search instead for 
Did you mean: 

SQL for hierarchical structures

former_member296836
Participant
0 Kudos

Dear all,

I have two database tables:

Table1:

IDNr

Name

Table2:

IDNr

AttachmentName

One entry from table1 could have 0..unbounded entries in table two.

I used a LeftJoin operation for this, but of course all entries from table 1 will

be duplicated if there are more than 1 entries for this in table 2.

IDNr  = 123

Name  = Test

AttachmentName = project.doc

IDNr  = 123

Name  = Test

AttachmentName = description.doc

(and so on)

Because table 2 came additionally, I would have to adjusted my complete mapping which

is huge.

Question: Is there a possibility in SQL to create a result structure like this:

IDNr = 123

Name = Test

AttachmentName = project.doc

AttachmentName = description.doc

Thanks

Regards

Chris

Accepted Solutions (0)

Answers (1)

Answers (1)

Harish
Active Contributor
0 Kudos

Hi Chris,

AFAIK - you can not create column dynamically in select statement. If you know max no of attachment then you can create a view in and call the view from view.