0

I have a list of data that happens to have been set up like this:

entryID    fieldID    Value
100        1          John
100        2          Smith
100        3          USA
101        1          Jane
101        2          Doe
101        3          USA

The way it works is, when a "ticket" is created, it assigns an entryID for all the data in that ticket, but each field also has it's own fieldID. So first name is always a fieldID of 1, last name is 2, etc. What I need to be able to do is create a view that will look like this:

First Name    Last Name    Country
John          Smith        USA
Jane          Doe          USA

I need to be able to do this in MySQL, and not SQL or excel, as some other similar problems have addressed.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43

1 Answers1

0

I just found the answer to my own question, so I will post it here for future users. This website explains how to do exactly what I was asking for: http://stratosprovatopoulos.com/web-development/mysql/pivot-a-table-in-mysql/

  • That is a lot of views to maintain for a simple pivot table that can be accomplished with `JOINS`. Imagine adding a new identifier as a column. You would have to update all three views. See my answer that you can create a view from. – Will B. Apr 29 '15 at 16:55