PIVOT table for account data with columns for each month
问题 The table I am looking in has the following columns: department_number, amount, date_created. I'm trying to create a table that shows the total amount for each department for each month in 2013, so it would look like this: Department_number, Jan Amount, Feb Amount, March Amt, etc.... Is this a case for pivot tables, or should I just run a different query for each month and join them? 回答1: Your case is certainly a candidate for using PIVOT table syntax. The below is a simple query which does