|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
MS SQL Query problem
I apologise in advance as I am a newbie when it comes to SQL.
I have a MS SQL 2005 database. In the database I have two tables: Table Name: Users Columns: UserID, Username, FirstName, LastName, IsSuperUser, AffliateID, Email, DisplayName, UpdatePassword Table Name: UserProfile Columns: ProfileID, UserID, PropertyDefinitionID, PropertyValue, PropertyText, Visibility, LastUpdatedDate Each UserID in Users can be matched to the UserID in UserProfile. In the Table UserProfile there are multiple instances of each UserID against which is listed a unique PropertyDefinitionID and PropertyValue as shown below. Table UserProfile Record 1 Profile ID: 1 UserID: 1 PropertyDefinitionID: 2 PropertyValue: 31 Gresham Street Record 2 Profile ID: 2 UserID: 1 PropertyDefinitionID: 4 PropertyValue: London etc etc I would like to build a view which shows the Username from the table Users and shows on a single row all the PropertyDefintionIDs and PropertyValues from the table UserProfile. Is that possible. Thanks in advance. |
|
#2
|
||||
|
||||
|
yes it's possible
http://sqlblindman.googlepages.com/creatingcomma-delimitedstrings FYI the design you have is called EAV (entity-attribute-value) and it is generally considered to be a poor data model |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > MS SQL Query problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|