The issue I ran into with SQL is that I tried to export data from one column that is linked to an ID into 3 other columns, however I ended up with lots of NULLS and multiple identical IDS as seen in the picture below.
I have a table with 4 columns, in these columns data is stored in a quite odd fashion. My table looks like this
entry_id| field_id | value | value_ID |
| 480| -5 | string of text| 10 |
| 480| -20 | string of other text | 10 |
| 480| -23 | Yes | 10 |
| 480| -22 | No | 10 |
I've designed a query that turns the field ID into a new column with the attached value.
The query looks like this:
SELECT
ticket.ticket_id,
ticket.number,
users.name,
CASE WHEN val.field_id IN (5) THEN val.value end as "Issue Summary",
CASE WHEN val.field_id IN (20) THEN val.value end as "Project Site",
CASE WHEN val.field_id IN (23) THEN val.value end as "Action"
FROM ost_ticket ticket
LEFT JOIN ost_form_entry entry ON (ticket.ticket_id = entry.object_id)
LEFT JOIN ost_form_entry_values val ON (entry.id = val.entry_id)
LEFT JOIN ost_user users ON (ticket.user_id = users.id)
LEFT JOIN ost_form_field fields ON (val.field_id = fields.id)
This query returns: https://i.stack.imgur.com/hqBv0.png (cant embed picture due to lack of reputation.)
As you can see I have multiple identical ticket ID' and lots of NULLS. What query should I use to have only one row per unique ticket_id