I have an array, with php I need to remove all NON duplicates on the "listingCode" from this array. For instance:
Array
(
[0] => Array
(
[name] => Supplier A
[listingCode] => ABC
)
[1] => Array
(
[name] => Supplier B
[listingCode] => ABC
)
[2] => Array
(
[name] => Supplier B
[listingCode] => DEF
)
[3] => Array
(
[name] => Supplier C
[listingCode] => XYZ
)
[4] => Array
(
[name] => Supplier D
[listingCode] => BBB
)
[5] => Array
(
[name] => Supplier E
[listingCode] => ABCDEF
)
[6] => Array
(
[name] => Supplier F
[listingCode] => ABCDEF
)
)
I have 1.2M records in this array. Basically when all is said and done, I just want to have elements 0, 1, 5, 6 left in the array. Is this possible?
Basically all of this data comes from 3 tables. I only want to display suppliers where any of the listingCode's may be duplicates. For instance listingCode 1,2,6,7 are duplicates, therefore display Supplier A,B,E,F
Supplier
----------------------
ID| Supplier Name
1 | Supplier A
2 | Supplier B
3 | Supplier B
4 | Supplier C
5 | Supplier D
6 | Supplier E
7 | Supplier F
Product
----------------------
ID| Product Name | Supplier ID
1 | ABC | 1
2 | DEF | 2
3 | GHI | 3
4 | JKL | 4
5 | MNO | 5
6 | PQR | 6
7 | STU | 7
Listing
----------------------
ID| Listing Code | Product ID
1 | ABC | 1
2 | ABC | 2
3 | DEF | 3
4 | XYZ | 4
5 | BBB | 5
6 | ABCDEF | 6
7 | ABCDEF | 7
Thanks