There is most likely a more efficient and simpler way to do the following. Suggestions and improvements are gladly accepted...
First we need a function that will return a value given a UserID and a PropertyName:
If all you need to do is display the data and there's not a ton of users, You can then run a Select statement along lines of:
In our case, we were dealing with several thousand users and we needed to Join the User Data to another table so, we created a Stored Procedure that:
1.)to maximize performance, we had limit the number of records retrieved from the user profile table
2.)Then we did a SELECT INTO a temp table.
3.)We then joined the data with our other table.
The Stored Procedure ended up looking something like this: