Grouping Elements
Posted: Sat Oct 20, 2007 1:34 am
I was wondering if it is possible to group linked elements using SQL
directly. For example, if I have some table like:
Column A | Column B | Column C | Column D
1 | 2 | A11 | A32
2 | 3 | A13 | A22
3 | 4 | A14 | A23
5 | 6 | A19 | A24
7 | 8 | A18 | A25
1 | 9 | A17 | A26
I want to group all linked items together. So in the above case my
output would look something like:
Table 1:
1
2
3
4
9
Table 2:
5
6
Table 3:
7
8
or maybe something like with the above one still preferred:
1,2,3,4,9
5,6
7,8
extracted into another table...
One other question I had was, can a database have a thousand tables? I
mean, if I had many such groups, would it be efficient to create a
table for each group or is there any other approach?
directly. For example, if I have some table like:
Column A | Column B | Column C | Column D
1 | 2 | A11 | A32
2 | 3 | A13 | A22
3 | 4 | A14 | A23
5 | 6 | A19 | A24
7 | 8 | A18 | A25
1 | 9 | A17 | A26
I want to group all linked items together. So in the above case my
output would look something like:
Table 1:
1
2
3
4
9
Table 2:
5
6
Table 3:
7
8
or maybe something like with the above one still preferred:
1,2,3,4,9
5,6
7,8
extracted into another table...
One other question I had was, can a database have a thousand tables? I
mean, if I had many such groups, would it be efficient to create a
table for each group or is there any other approach?