B*****g 发帖数: 34098 | 1 SELECT HouseID, APhoneNumber, AStatus, 'A' PhoneColumns
UNION ALL
SELECT HouseID, BPhoneNumber, BStatus, 'B'
UNION ALL
....
PhoneColumns may be used for remove duplicate
busy, |
|
n********6 发帖数: 1511 | 2 Background:
Collected phone number from 10 sources for each household. Past validation
indicates phone number may have one of 20 status (1, valid, 2, fax, 3, busy,
4, person died, 5, ill, 6, in jail, ... 20)
Question:
Any way to do one query without using cursor go through whole table? (no
concern on performance issue)
Old Table:
HouseID (PK)
APhoneNumber
AStatus
BPhoneNumber
BStatus
...
GPhoneNumber
GStatus |
|