First, no matter how you slice it, you need a unique key. It can be a combination of columns, but you absolutely must have some means of uniquely identifying each row. Without that, your best recourse is to add such a constraint. In addition to that constraint, this type of request is best served by also having a single unique column. However, if you do not have such a column, you can create it from the columns that do comprise the unique key by concatenating them together:
Select T1.account, T1.phone, T1.subaccount, T1.locationId....
From "Table" As T1
Where (Cast(T1.UniqueCol1 As varchar(100))
+ "|" + Cast(T2.UniqueCol2 As varchar(100)
... ) = (
Select Min( Cast(T2.UniqueCol1 As varchar(100))
+ "|" + Cast(T2.UniqueCol2 As varchar(100))
...
)
From "Table" As T2
Where T2.account = T1.account
And T2.phone = T1.phone
)
In this case UniqueCol1
represents one of the columns of the unique key, UniqueCol2
represents the next and so on. This will not be a fast query by any means. Having a single column guaranteed to be unique would make this problem significantly simpler. With that, you can do something akin to Mike M's solution:
Select T1.account, T1.phone, T1.subaccount, T1.locationId....
From "Table" As T1
Where UniqueCol = (
Select Min( T2.UniqueCol )
From "Table" As T2
Where T2.account = T1.account
And T2.phone = T1.phone
)
An important point to be made here is that in both solutions above "first" is being determined simply by the lowest sorted key value found. If "first" needs to be determined by something else, like a datetime column, you need to mention that your in your post.
EDIT
Given your addition that this is an import, the simplest solution is to add an auto-incrementing column to your staging table. In SQL Server this would be an IDENTITY column but other database products have an equivalent. If you do that, then the last solution I presented above will do the trick (simply replace UniqueCol with the name of your Identity column).