Hi,I have a query which imports data into an excel table.The issue I have is some of the columns the data needs to be transpose?Below is the current query I currently have what I need is the names in VARIABLE_NAME to be in the columns e.g. one variable would be sales which appears multiple times (once per site) end result would be one column with sales followed by the sites sales. The data that needs to go under the VARIABLE_NAME is in the TOTAL section of the query.End result is to have VARIABLE_NAME in the columns followed by the TOTAL in the VARIABLE_NAME column.Hope that makes sense?If its not possible or the code is complicated then I will try and tackle in excel somehow. SELECT a.CLIENT_ID ,d.CLIENT_NAME ,a.SITE_ID ,c.SITE_NAME ,e.OPERATIONS_MANAGER ,e.MANAGER ,a.AUDIT_DATE ,b.VARIABLE_NAME ,a.TOTAL FROM MMA_KPIVAR_DAT aINNER JOIN MMA_KPIVAR_MST bON a.CLIENT_ID = b.CLIENT_IDAND a.GRAPH_ID = b.GRAPH_IDAND a.CHART_ID = b.CHART_IDAND a.VARIABLE_ID = b.VARIABLE_IDINNER JOIN MMA_SITE_MST cON a.CLIENT_ID = c.CLIENT_IDAND a.SITE_ID = c.SITE_IDINNER JOIN MMA_CLIENT_MST dON c.CLIENT_ID=d.CLIENT_IDINNER JOIN MMA_AUDITOR_LOGIN AS EON a.SITE_ID=e.SITE_IDAND a.AUDIT_DATE = e.AUDIT_DATEINNER JOIN MMA_KPICHART_MST AS fON a.CLIENT_ID =f.CLIENT_IDAND a.CHART_ID =f.CHART_ID WHERE a.CLIENT_ID = 10 AND a.AUDIT_DATE BETWEEN ‘2014-07-01’ AND ‘2014-12-28’Thanks for any help,J
↧