Francisco Hillyer looks at creating Pivot Tables with SQL using The Sum of Payments Posted Per Vendor Per Month as an example.
Pivot Tables with SQL? The Sum of Payments Posted Per Vendor Per Month
SQL & DataPayables & ReceivablesExcel & Office
Archived post from 2011. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.