返済が属するローンごとに 16 行の返済テーブルがあります。
Repayments
loanid repid amnt
--------------------
a1 r1 1,100
a1 r2 1,100
| | |
a1 r16 1,105
b2 s1 2,500
b2 s2 2,500
| | |
b2 s16 2,510
| | |
Loans
loanid othercolumns...
-----------------------
a1
b2
|
blahid
|
LoanIds は文字列です。返済IDも
すべてのローンの各返済から最初の 15 行を取得するクエリを探しています。
loanid repid amnt
a1 r1 1,100
a1 r2 1,100
| | |
a1 r15 1,105
b2 s1 2,500
b2 s2 2,500
| | |
b2 s15 2,510
| | |
これはSQLで可能ですか?もしそうなら、どのように?