表 A 有 userIdentity (primaryKey) userName userPhoneNumber
表 B 有 someOtherKey(primaryKey) userIdentity userLocation
运行时,我得到 22 行具有唯一 userIdentity 的行
SELECT *
FROM tableB
WHERE tableB.timeStamp > '2013-11-1'
GROUP BY tableB.userIdentity ;
运行时我只得到 2 行(我打算在上述查询中提取 22 行的姓名和电话号码)
SELECT tableA.userName, tableA.phonePhoneNumber
FROM tableB
JOIN tableA
WHERE tableB.timeStamp > '2013-11-1'
GROUP BY tableB.userIdentity
AND tableA.identityHash = tableB.identityHash;