Best way to flatten/denormalize SQL lookup tables?

后端 未结 3 1727
刺人心
刺人心 2021-02-14 19:03

I have a bunch of tables like this:

Lookup_HealthCheckupRisks
------------
ID  Name
1   Anemia
2   Anorexic
3   Bulemic
4   Depression
...
122   Syphilis



Pati         


        
3条回答
  •  日久生厌
    2021-02-14 19:44

    Use PIVOT TABLE Here - Microsoft and here - tutorial.

    You will need hovewer to specify all the columns. But you can use sp_executesql command to use dynamic SQL.

提交回复
热议问题