I am guessing this is a noob question so please bear with me. I have a column in a mySQL table that contains both first name and last name plus other data (see table below).
fid | uid | value
5 | 1 | John
6 | 1 | Doe
7 | 1 | some other data
5 | 2 | Jane
6 | 2 | Doe
7 | 2 | some other data
What I would like to do is create a query where I split out the first and last names into their own columns for reporting purposes (like shown below).
First Name | Last Name
John | Doe
Jane | Doe
I haven’t seen this question asked before here nor have I been able to Google (perhaps using the wrong keywords). I assume this is relatively simple but it is eluding me.
Thanks.
You just need to join the table to itself with something like this:
You can join a table to itself or join the same table multiple times as long as you use a different alias for each instance of the table.