I'm attempting to combine data in MySQL into a view or stored procedure to either write back out to a new table or access as a view. My database stores customer meta in a separate line with keys and values. I'm puzzled as to how to extract this data in a useful form.
My data is formed this way:
id order customer type key value
1 42FF86A1 45858007 shipping address-name David Customer
2 42FF86A1 45858007 shipping email-address david@email.com
3 42FF86A1 45858007 shipping number 2125551212
4 42FF86A1 45858007 shipping address-line1 5353 My Street
5 42FF86A1 45858007 shipping address-line2 #2
6 42FF86A1 45858007 shipping city MyCity
7 42FF86A1 45858007 shipping region CA
8 42FF86A1 45858007 shipping postal-code 95555
9 42FF86A1 45858007 shipping country US
Ultimately I'd like to be able to read the data and export it easily for use in my CRM or Excel.
I've attempted to implement https://stackoverflow.com/a/5967720/3001841 but it just doesn't make sense to me how.
Simply getting the data in a single row would be useful to me where:
customer,order,address-name,address-line1,address-line2,city,region,postal-code,country,email-address,number