Click here to Skip to main content
15,886,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all!

I'm a newbie here, and 've been looking through the forum but I'm so lost ill be needing a bit of help.

I'd like to know where should I start reading/learning in order to do the following:

I have a hosted SQL table with sales info with the following columns:

Date - Location - Vendor - Sales - Units - Transactions ......
Id like to build a pivot table (excel-like) with date and location filters. Vendor as Rows and Sales , units and transaction as collumns.

Addtionally, id like to add extra collumns based on formulas such as "Units/Transactions".

At the very end of each collumn, a different calculation may occur (SUM, Average, Count...)


Would you please enlighten me as how to do so? Whats the best programming lenguage? any tutorial for pivot tables proccesing sql data?

I dont want to be excel dependent as id like to create an user login form and stablish a predefined location and built more funcs from there on.


Thank you all!

What I have tried:

I've tried to do so in a web based enviroment. Pivoting is quite difficult and the only way i found is using "flexmonster" software.
Posted
Updated 2-May-20 2:30am
v2

1 solution

Probably the most important thing to include with your question is to be specific with the environment information.

I also have data stored out in the cloud. It happens that I happen to be working with MS SQL Server which actually has native support for PIVOT.
Similar functions are available in some other databases, such as Oracle.

Other database types (such as MySql or MariaDB) do not have native PIVOT or similar functions and require tools. One of these is called dbForge Studio.

So... your answer depends primarily on what type of DB you are running.
1. There are some links below to review
2. Be specific when using Google for db questions- MySQL pivot

One of the most important things to remember is that a database is primarily for storing data. Secondary functions such as reporting and text manipulations are often better performed at the presentation layer.

And don't forget... Excel can be hooked up to use a database for it's information source, and it is where most people learn PIVOT

References:
Using PIVOT and UNPIVOT - SQL Server | Microsoft Docs[^]
Pivot Tables in MySQL[^]
SQL Pivot in all databases: MySQL, MariaDB, SQLite, PostgreSQL, Oracle, …[^]
MySQL GUI Tool - MariaDB and MySQL Front End Client[^]
 
Share this answer
 
Comments
phil.o 2-May-20 8:46am    
5'd
MadMyche 2-May-20 9:14am    
~ Merci

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900