I have three tables as below.
Main table:
Category look up table:
Seller lookup table:
Now I want to represent my data as below
What will the easiest way to do it in a SQL select statement? I would probably like to avoid any cursor or temp tables but rather using string_arg
, cross apply
, string split
kind of functions to do it within select (if possible which I tried but could not arrive to a final solution ). I can also use ADF dataflow if needed.
1条答案
按热度按时间khbbv19g1#
Can't comment this, so here it is in answer format. This is just an example of one way to do so using outer apply. You'll have to do something similar for each table. I hope you can take it from here?
This does not address obvious design flaws in your data structure.