Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double insertion

Status
Not open for further replies.

231166

Programmer
Apr 5, 2005
104
FR
Hi,

Here is the situation,

I have created a treeview which contains terms from the TERMES table.
Its fields are : ID_TERME which is the identifier of each term and Lib_TERME which contains the label of each term.


These terms are organised hierarchically.

To see the relations generic(parent)/specific(child), i have created the GENERIQUES tables which fields are

ID_TG(autoincrementednumber) which is the identifier of this table, ID_TERME_SOURCE_G, which contain the number of each child term and ID_TERME_GENERIQUE which contain the number of each parent term.

The number which are in the two fields ID_TERME_SOURCE_G and ID_TERME_GENERIQUE correspond to an ID_TERME from the TERMES table( these are two values of ID_TERME).

The MICROTHESAURUS table contains these tree fields : ID_MT(autoincremented number), ID_TERME_SOURCE which correspond to an ID_TERME of the TERMES Table and ID_MICRO_THESAURUS which is the number of the microthesaurus( semantic field) this term belongs to.

[blue]Now there is a case where a user wants to insert a same term to two different places in the treeview.[/blue]


In fact, i have understood we need to insert in the MICROTHESAURUS table this new term( which already belongs to the TERMES table)

[red]But we need also to insert into this table ALL ITS CHILDS!!![/red]

Could you help me to create the sql request to insert all the child of the new terme which ID_TERME is already in the TERMES table.

For example , if in the table TERMES i have this

ID_TERME Lib_TERME

12 velo

13 bicyclette

14 moto

15 cycles

If in the GENERIQUES table i have this
[blue]

ID_TERME_SOURCE_G(child) ID_TERME_GENERIQUE (parent)


15 0( 0 means there is no parent term, so it is the root)
14 15
12 15
13 15
[/blue]
In the MICROTHESAURUS table i have this
[blue]
ID_TERME_SOURCE ID_MICRO_THESAURUS

15 3
14 3
12 3
13 3
[/blue]
If a user wants to insert twice the term'CYCLES' in the microthesaurus which number is 4, so i need to see this in the MICROTHESAURUS table
[green]
ID_TERME_SOURCE ID_MICRO_THESAURUS

15 4
14 4
13 4
12 4
[/green]
Which sql request do i need to write to see inserted the term which ID_TERME = 15 [red]BUT ALSO ALL ITS CHILDS !!![/red]

Thanks a lot for your help.
Best regards.

Nathalie


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top