My problem :
I have a mysql table which currently stores values from a form which allows organizations to request for a demo from another organization . The form field values are : firstname , lastname,email_id,phone.
I am storing these values in key / value pairs in a mysql table in the following way :
id(int) form_name(varchar) request_id(varchar) key(varchar) value(varchar)
1 demo 1479568061 firstname john
2 demo 1479568061 lastname Deere
3 demo 1479568061 email_id jd@gmail.com
4 demo 1479568061 phone 123-123-1234
5 demo 1479568301 firstname samuel
6 demo 1479568301 lastname jones
7 demo 1479568301 email_id sj@gmail.com
8 demo 1479568301 phone 134-145-1456
The id column is the primary key .
I have stored (php)timestamp values in request_id column . Each set of values (per form submission) has a unique timestamp value . For e.g records with id from 1 till 4 will have the same request_id .
I would like to query my table in such a way so that the administrator can view each set of records pertaining to a single form submission .
For instance the administrator should be able to view the records in the following way
firstname lastname email id tel no
john deere jd@gmail.com 123-123-1234
My research :
MySQL fetching a key value pair which are in two different columns
Need a MySQL query for selecting from a table storing key value pairs
Order query results by two key/value pairs, where the fields for the key/value pairs are the same
Any help will be appreciated .