我有两张桌子
顾客
CustomerID name x2 x3
--------------------------------
14tr Joe att2 att3
11ty Jack att2 att3
订金
Depositid CustomerID quantity date att3 att4
--------------------------------------------------
13 14tr 100 12-12-12 5 6
14 14tr 200 12-13-12 8 1
15 14tr 140 12-16-12 9 6
16 11ty 10 12-19-12 1 6
17 11ty 20 12-19-12 1 1
18 11ty 114 12-21-12 1 6
我想要以下结果:
结果
No name quantity date att3 att4 x2 x3
-----------------------------------------------------------------------
1 Joe 100 12-12-12 5 6 att2 att3
1 Joe 200 12-13-12 8 1 att2 att3
1 Joe 140 12-16-12 9 6 att2 att3
2 Jack 10 12-19-12 1 6 att2 att3
2 Jack 20 12-19-12 1 1 att2 att3
2 Jack 114 12-21-12 1 6 att2 att3
为此,我正在做
SELECT
b.name,
a.quantity,
a.date,
a.att3,
a.att4,
b.x2,
b.x3
FROM
Deposit a INNER JOIN Customer b
ON a.CustomerID = b.CustomerID;
如何获得示例中每个不同客户的编号列计数器?
有没有更好的方法来显示这两个表之间的内部连接?