I am looking to find a query to swap my columns and rows where my table does not have a number.
Below are the specifics. My AuditID field is a sequential number, and all my fields start with ‘X’, and the values in those fields are ‘Yes’, ‘No’, or ‘N/A’.
I am looking to put my AUDITID field in columns, and put each ‘X’ field as a new row.
The X fields are used in a form, and the admin users would like to see each question (each ‘X’ field) as a row with each response listed out left to right (AUDITID left to right) so that they can see responses by question easily.
Base Table using this query:
select
AUDITID
,X1A
,X1B
,X2A
,X2B
,X2C
from AUDIT_FORM_PREBILL_HHA
Result:

Desired Output:
