I’m a noob at SQL things and I’m looking to do something here. I’ve search around and haven’t found a way to do it, perhaps because I don’t know how to explain it and therefore maybe I’m not searching correctly.
Here’s the problem:
I have a Table with 3 columns that serves as an auxiliary set of properties for a different Table (but that’s kinda irrelevant to the problem).
What I have:
--------------------------------------------
listing_id | field_id | listing_value
--------------------------------------------
1 Fruit Apple
1 Color Red
2 Fruit Banana
2 Color Yellow
3 Fruit Grape
3 Color Purple
What I want to get:
----------------------------------------------------
listing_id | listing_value_1 | listing_value_2
----------------------------------------------------
1 Apple Red
2 Banana Yellow
3 Grape Purple
Keep in mind this is all happening at the same table.
This is all for selecting values, so the query must start with SELECT
I’ve tried the JOIN, GROUP and UNION commands but I haven’t gotten any successful results.
Also, I’m trying to get this to work via phpMyAdmin which lacks a few commands (for example I can’t use INTERSECT, I can use Select * FROM x but can’t seem to useSELECT x.*)
thanks in advance 🙂
Try this