MySQL Forums
Forum List  »  Optimizer & Parser

Pivot table with dynamic columns
Posted by: Aram Mirzadeh
Date: September 30, 2016 06:03PM

Hi,

I have a dynamic requirement. I am trying to build a view (via SPROC) that would generate a list of vendor_fk as the left column and each product as a column after that. The cells of the pivot would be the latest date on which there is an try for that product/vendor combination entry.

I have setup a sqlfiddle with the relevant schema/sample data. I can also share my SPROC but the query middle part is in the fiddle as well -- iteration #2. Iteration #1 only listed 1 product per vendor row no matter how many entries there were.

Fiddle Schema: http://sqlfiddle.com/#!9/92bc9/7

Any help would be greatly appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
Pivot table with dynamic columns
6629
September 30, 2016 06:03PM
2516
October 03, 2016 03:40PM


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.