Given the following table setup, how do I select the meta_values from both rows that have a common post_id?
I'm looking to return something like:
- Bob is married to Jane
- Pete is married to Amanda
- Rick is married to Sally
+-----------+------------+--------------+
| post_id | meta_key | meta_value |
+-----------+------------+--------------+
| 10 | 'key_1' | 'Bob" |
+-----------+------------+--------------+
| 10 | 'key_2' | 'Jane' |
+-----------+------------+--------------+
| 20 | 'key_1' | 'Pete" |
+-----------+------------+--------------+
| 20 | 'key_2' | 'Amanda' |
+-----------+------------+--------------+
| 30 | 'key_1' | 'Rick" |
+-----------+------------+--------------+
| 30 | 'key_2' | 'Sally' |
+-----------+------------+--------------+
Thanks in advance for your help.
source https://stackoverflow.com/questions/69003288/how-to-select-columns-from-different-rows-that-share-a-common-column-value
Comments
Post a Comment