everywhere I found solutions for removing duplicate entries in php or mysql. But all those solutions removed the whole row, but I just want to remove the value of a column. for example I have this SELECT in mysql:
SELECT HE_FRUIT as fruit, CA_FRUIT as candy, CA_FRUIT_NAME as name, CA_FRUIT_color as color
FROM fruits LEFT JOIN candy ON HE_FRUIT_ID = CA_FRUIT_ID
WHERE CA_FRUIT_COUNTRY LIKE '%usa%'
GROUP BY CA_FRUIT_TITLE
ORDER BY CA_FRUIT_PRIO, CA_FRUIT_HE
I print the array and I get this:
array
0 =>
array
fruit = "APPLE"
candy = "lolly"
name = "xxx"
color = "green"
1 =>
array
fruit = "APPLE"
candy = "gum"
name = "xxx"
color = "blue"
2 =>
array
fruit = "APPLE"
candy = "candy"
name = "xxx"
color = "red"
3 =>
array
fruit = "BANANA"
candy = "lolly"
name = "xxx"
color = "yellow"
What I want to have is:
0 =>
array
fruit = "APPLE"
candy = "lolly"
name = "xxx"
color = "green"
1 =>
array
fruit = ""
candy = "gum"
name = "xxx"
color = "blue"
2 =>
array
fruit = ""
candy = "candy"
name = "xxx"
color = "red"
3 =>
array
fruit = "BANANA"
candy = "lolly"
name = "xxx"
color = "yellow"
So it's only the value of the column fruit that should be removed, but all the rest should stay.
Does someone has an idea how I could solve this problem, without to much extra code?
Thanks so much in advance?