我有一个类似这样的 SQL 表:
+-----------------------------------------------+
| ID | FirstName | LastName | SomeOtherData|
+-----------------------------------------------+
| 200 | Robert | Barone | Foo |
| 228 | Doug | Heffernan | Bar |
| 2091 | Robert | Barone | Foo |
| 3921 | Doug | Heffernan | Bar |
| 291 | Greg | Warner | Barfoo |
+-----------------------------------------------+
现在我在生成一个表格时遇到了麻烦,该表格将列出给定人员的两个 ID,假设 FirstName 和 LastName 用于指示重复项。所以,基本上我想得到:
+---------------------------------------------------------+
| ID | OtherID | FirstName | LastName | SomeOtherData|
+---------------------------------------------------------+
| 200 | 2091 | Robert | Barone | Foo |
| 228 | 3921 | Doug | Heffernan | Bar |
| 291 | | Greg | Warner | Barfoo |
+---------------------------------------------------------+
有人能帮我解决这样的问题吗?谢谢!