Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
REEPER
Yak Posting Veteran
53 Posts |
Posted - 2008-02-14 : 16:01:24
|
Is there a way to change this query:SELECT UserDefinedData.UserDefinedFieldId, UserDefinedData.UserDefinedRowId, UserDefinedFields.FieldTitle, UserDefinedData.FieldValueFROM UserDefinedData INNER JOIN UserDefinedFields ON UserDefinedData.UserDefinedFieldId = UserDefinedFields.UserDefinedFieldId INNER JOIN UserDefinedRows ON UserDefinedData.UserDefinedRowId = UserDefinedRows.UserDefinedRowIdWHERE (UserDefinedRows.ModuleId = 681) AND (UserDefinedData.UserDefinedFieldId > 62)ORDER BY UserDefinedData.UserDefinedRowId, UserDefinedData.UserDefinedFieldIdThat produces this example result:63 1396 Title Test64 1396 Summary <p>This is a test of the new job posting system...this is only a test</p>65 1396 Functions <p>test</p>66 1396 Education <p>test</p>67 1396 Knowledge <p>test</p>68 1396 Locations South Hill, VA70 1396 Qualifications <p>test</p>63 1397 Title Testing64 1397 Summary <p>Test</p>65 1397 Functions <p>test</p>66 1397 Education <p>test</p>67 1397 Knowledge <p>test</p>68 1397 Locations testColumn1 = UserDefinedFieldIDColumn2 = UserDefinedRowIDColumn3 = FieldTitleColumn4 = FieldValueI would like flatten out the above dataset and return just 2 rows.So the columns would be:Title | Summary | Functions | Education | Knowledge | Locations | QualificationsI've heard use the PIVOT function but I have been unsuccessful creating the coorect syntaxMCP, MCSD |
|
jobejufranz
Starting Member
33 Posts |
Posted - 2008-02-27 : 05:22:38
|
Hi,have you found the solution because if not maybe i can help you rewrite the querycheers. |
|
|
|
|
|