View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jamie Collins Jamie Collins is offline
external usenet poster
 
Posts: 593
Default group pivot table from external source

scottwilsonx wrote ...

Hi everyone, I have an excel pivot-table whose source is an external SQL
server.
I have pulled across all the rows I want, however I want to create a
new field that groups the "names" variable.


I'm assuming you have a column named "names" (consider renaming
because NAMES is vague and a reserved word for future use in SQL
Server).

If you have control over the sql, you could simply make [names] the
first column in your ORDER BY clause e.g.

SELECT
MyKeyCol, MyTextCol, Names
FROM
MyTable
ORDER BY Names, MyTextCol
;

If you do not have control over the sql (e.g. you only have
permissions to run a stored procedure) you could use an ADO recordset
and sort by [names] on the client side.

Post some more details e.g. sql code, example data, required
groupings, etc.

Jamie.

--