Giuseppe Lolli
Giuseppe Lolli

Reputation: 177

Retrieving data from a SQL table with filters to Excel

i have a doubt and i don't know if it is possible to do. I have a huge table on my database, like a million of records, and i would like to know if there is a way to create a pivot table in Excel and call a query to show data in my workbook previously filtered by a selection, for example:

My Table on my database:

SKU                     STYLE         CATEGORY      BRAND      STORE      COUNTRY
----------------------------------------------------------------------------------
ADIDAS BLUE PANT XL     BLUE PANT     PANT          ADIDAS     STORE 1    USA
ADIDAS BLUE PANT L      BLUE PANT     PANT          ADIDAS     STORE 1    CANADA
ADIDAS BLUE PANT S      BLUE PANT     PANT          ADIDAS     STORE 2    AUSTRALIA
ADIDAS RED HAT XL       RED HAT       HAT           ADIDAS     STORE 2    AUSTRALIA
ADIDAS RED HAT L        RED HAT       HAT           ADIDAS     STORE 3    USA
ADIDAS RED HAT S        RED HAT       HAT           ADIDAS     STORE 3    KONGO
ADIDAS BLACK SHIRT XL   BLACK SHIRT   SHIRT         ADIDAS     STORE 2    KONGO
ADIDAS BLACK SHIRT L    BLACK SHIRT   SHIRT         ADIDAS     STORE 1    USA
ADIDAS BLACK SHIRT S    BLACK SHIRT   SHRIT         ADIDAS     STORE 4    USA
...
.....
......

Before load the entire dataset to Excel i would like to tell the query to filter by store or category... Then, do a Pivot table with in order to let the user chose which columns they want to see.

Upvotes: 0

Views: 2294

Answers (1)

ASH
ASH

Reputation: 20302

Take a look at this.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

The nice thing about pivoting data in Excel , from another source, is that you can pull in records that far exceed 1,048,576 rows in the source, aggregate records in Excel, and you could still stay well under the 1,048,576 row limit in Excel.

Check out this link as well.

https://www.ptr.co.uk/blog/how-do-you-create-pivot-tables-sql-server-queries

Upvotes: 2

Related Questions