MySQL Forums
Forum List  »  Italian

Query con dati pivotizzati o SP?
Posted by: Emmanuel Avetta
Date: August 12, 2013 03:12PM

Ciao a tutti,
sto cercando di fare una query che mi restituisca dei dati "pivotizzati" ma non ci riesco. Ho pensato soltanto ad una stored procedure con cursore che mi pivotizzi i dati in una tabella temporanea o a del codice php che generi una matrice. Sapete dirmi se c'è una query fattibile per fare lo stesso tipo di lavoro evitando SP e codice in PHP?
Ecco un esempio della struttura delle tabelle e la tabella finale con i dati formattati come mi servirebbero:

TabDati-----------TabImprese---------TabMesi
id_impresa-------id_impresa----------id_mese
id_mese----------NomeImpresa------NomeMese
VenditeEuro


Recordset risultante:

Mese--------Impresa1-----Impresa2-----Impresa3-----Impresa4-----...
Gennaio-----€45,00--------€12,00--------€34,00--------€76,00-------...
Febbraio----€67,00--------€34,00--------€56,00--------€93,00-------...



Grazie tante!

Options: ReplyQuote


Subject
Views
Written By
Posted
Query con dati pivotizzati o SP?
1575
August 12, 2013 03:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.