Result from Rows to Columns based on Form id

  • Hi,

    Below is my query, where i get the results for each each form id in rows, however id need to get the result in columns, what changes do i need to make

    SELECT vwNiceDBKithierarchygroup.nvcGroupName,

    vwNiceDBKitEvaluationQuestions.iEvalID,

    vwNiceDBKitgroupmembers.nvcFirstName,

    vwNiceDBKitgroupmembers.nvcLastName,

    vwNiceDBKitEvaluationQuestions.dtEvaluatedStartTime,

    vwNiceDBKitEvaluationQuestions.dtCreationTime,

    vwNiceDBKitEvaluationQuestions.dtModificationTime,

    vwNiceDBKitEvaluationQuestions.flScore,

    vwNiceDBKitEvaluationQuestions.tiEvaluationType, vwNiceDBKitEvaluationQuestions.nvcFormName,

    vwNiceDBKitEvaluationQuestions.ncvReportLabel,

    vwNiceDBKitEvaluationQuestions.nvcSectionCaption,

    vwNiceDBKitEvaluationQuestions.nvcAnswerCaption,

    vwNiceDBKitEvaluationQuestions.nvcQuestionAnswer,

    vwNiceDBKitEvaluationQuestions.nvcValue,

    vwAgent.nvcLoginName

    FROM nice_dw.dbo.vwNiceDBKithierarchygroup, nice_dw.dbo.vwNiceDBKitgroupmembers,

    nice_dw.dbo.vwNiceDBKitEvaluationQuestions, nice_dw.dbo.vwAgent

    WHERE (vwNiceDBKithierarchygroup.nvcGroupName in ('Hyderabad'))

    AND (vwNiceDBKithierarchygroup.iGroupId=vwNiceDBKitgroupmembers.igroupid) AND (vwNiceDBKitgroupmembers.iUserID=vwAgent.iUserID)AND

    (vwNiceDBKitgroupmembers.iUserID=vwNiceDBKitEvaluationQuestions.iagentuserid) AND

    (vwNiceDBKitEvaluationQuestions.dtCreationTime Between '01Jan2011 12:00:00 AM' And '31Jan2011 11:59:59 PM')

    AND (vwNiceDBKitEvaluationQuestions.nvcFormName

    In ('GE Money RCF QCAL Form V**','GE Money QCAL default form V**', 'GE Money QCAL EWS form'))

  • Hi and welcome to SSC. I don't quite understand what you want. Please a take a few minutes to read the first link in my signature for best practices when posting questions. If you can give us some clarification of your question we can help.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply