stored procedures - SQL Server: rearrange and flatten out table of values? -


i working on stored procedure retrieves values database.

i able values need, i'm having hard time figuring out how order them way need.

below i'm trying achieve. have table properties (left), , need create table newproperties running select on properties.

please note:

  • the field valuetypeid either 68 or 80.
  • the field value never same. each value long string of chars changes each value (i have simplified question)

enter image description here

i think should starting point of select statement:

select   p.genericid,   p68.value valuetypeid68,   p80.value valuetypeid80 partials p join partialsprops p68   on p.genericid = p68.genericid   , p68.valuetypeid = 68 join partialsprops p80   on p.genericid = p80.genericid   , p80.valuetypeid = 80 

you can add @cycle , @clientaccountid conditions on top of it.

sql fiddle: http://www.sqlfiddle.com/#!6/472de/1


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -