question

Caldan80 avatar image
Caldan80 asked

Dynamic pivot tables?

Hi All,


Very new to sql so and are having a hard time trying to work out if this is possible, effectively i am trying to create a dynamic pivot table based on the below table data, with multiple columns based on how many products and adjuvants are in the treatment. Please view the image for the two tables i keep trying to add the query table and it keeps messing it up.

Proposed Pivot table result please see the pdf

I have no idea if this is even possible, i was thinking of creating multiple group queries and joining them on the treatment_id, ie based on the results of a count if its a product or adjuvant (confrim_adjuvant) and grouping based on how many there are, any help is greatly appreciated. Truly sorry about how difficult it is to read.


Thank you in advance.

pivot
table1.jpg (54.7 KiB)
table2.jpg (59.8 KiB)
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.