0

please, i have a database, in this database i have a table (FICHENAME), this elements have several criteria (Ex : core competence and condition of access and ..) each element for the criteria is represented by a table in this database.

i need to create a combination between the same table to compare FICHENAME1 with (FICHENAME1 and FICHENAME2 and .....FICHENAME N) if i have a common criteria i insert 1 in bit column.

in this image you have a FICHENAME table with the criteria i need to compare with the same enter image description here

i need solution to representing this data or only create this combination (solution : SQL, SSIS, ..) enter image description here

Ismahane
  • 27
  • 2
  • 8

4 Answers4

0

A self join is simply when you join a table with itself.

http://www.tutorialspoint.com/sql/sql-self-joins.htm

SQL join on multiple columns in same tables

[What is SELF JOIN and when would you use it?

Community
  • 1
  • 1
Hans
  • 269
  • 4
  • 14
  • Hi, thank you for your answer. but there isn't solution for my question :'( i need to create a combination F1 with F1 and F2, F3...Fn Thank you so much – Ismahane Dec 15 '14 at 10:08
0

If your table has a single column & you need to make combinations of it's element multiple times, then i'd suggest you query same table twice with no joins. In hat scenario you will get combination of elements with all possibilities.

SELECT S1.FICHENAME, S2.FICHENAME FROM your_table S1, your_table S2 ORDER BY S1.FICHENAME, S2.FICHENAME

Rohan
  • 1,960
  • 3
  • 22
  • 30
0

thank you for your answer, i can use Cross join to create a combination :D

http://www.sqlguides.com/sql_cross_join.php

Ismahane
  • 27
  • 2
  • 8
0

Simply use SelfJOin

Eg.

SLEECT a.FetchName1

FROM table a inner join table b On a.FetchName1=b.FetchName2 INNER JOIN Table c on a.Id=c.Id

Ezhil Arasan
  • 450
  • 3
  • 5