M***7 发帖数: 2420 | 1 Hi all. I am a newbie with SQL. Here is my question:
The table is like
col1 col2 col3
a1 1 c
a1 2 a
...
a1 100 t
a2 1 d
a2 2 c
...
a2 100 g
a3 1 h
...
a3 100 d
now I am trying to make a function. The parameters are 2 ints of col2(such
as 2,81). I want to return a table containing the composition of that two
input parameters which is like
for parameter (2,81)
dt 10%
ac 40%
tt 50%
could anyone help me out? |
h****n 发帖数: 101 | 2 ok once again, what do you exactly want? pick 2 ints of col2 and then... |
B*****g 发帖数: 34098 | 3 co-ask
【在 h****n 的大作中提到】 : ok once again, what do you exactly want? pick 2 ints of col2 and then...
|
M***7 发帖数: 2420 | 4 Sorry for the confusion.
this query is like suppose I have a sequence a1 with "agdgteddgg", then I
put it into the table as below:
col1 col2 col3
a1 1 a
a1 2 g
a1 3 d
...
a1 10 g
then I get 9 other different sequences (a2-a10) and put them into the table
in the same format.
Then I want to check for all sequences, what is the combination of
composition at position 2 and position 8.
so it could be |
B*****g 发帖数: 34098 | 5 what DB?
which version?
Is every sequence length is 10?
其实,self join就行了
table
【在 M***7 的大作中提到】 : Sorry for the confusion. : this query is like suppose I have a sequence a1 with "agdgteddgg", then I : put it into the table as below: : col1 col2 col3 : a1 1 a : a1 2 g : a1 3 d : ... : a1 10 g : then I get 9 other different sequences (a2-a10) and put them into the table
|
h****n 发帖数: 101 | 6 有点像data warehouse的特定时间段or events消费行为分析 |
W*******r 发帖数: 15 | 7 I would just read the table into memory and implement your logic in java. |