Question: Here, my currently working query is

```
$results = DB::table('amenities as a')
->leftJoin('amenity_values as av','av.amenity_id','=','a.id')
->leftJoin('units_amenities_values as uav','uav.amenity_value_id','=','av.id')
->leftJoin('units as u','uav.unit_id','=','u.id')
->leftJoin('amenity_pricing_reviews as apr','apr.unit_id','=','u.id')
->select('a.id as amenity_id','a.amenity_name','a.category_id', 'av.amenity_value','u.id as unit_id','u.unit_number','apr.dom','apr.building_id')
->where('a.property_id', $data['property_id'])
->whereIn('apr.building_id', $data['building_ids'])
->whereNull('apr.deleted_at')
->whereNull('u.deleted_at')
->whereNull('av.deleted_at')
->whereNull('a.deleted_at')
->orderBy('a.amenity_name','asc')
->get()
->groupBy(['category_id','unit_id']);

```

Here, I have joined to a table `amenity_pricing_reviews`. In this relationship whenever it could not find the related rows in the `amenity_pricing_reviews` table it is discarding the full rows:

However, I want to get these rows with an empty value for those columns from that table. Something like:

```
amenity_id  => value
amenity_name => value
category_id => value
amenity_value => value
unit_id => value
unit_number => value
dom => 
building_id => 

```

Also, I have done a lot of other things based on the result of this query so I want to make minimal changes to the structure of the end result.

Answer: 
For a `Picker` to work properly, its elements need to be identified.

Note that the `selectedFlavor` variable is of type `Flavor`. Which means the options in the Picker should be identified as Flavors (not Strings).

However, in your code your `id` is of type `String`:

```
var id: String { self.rawValue }

```

---

You can either:

* provide a `tag` (of type `Flavor`):

```
Text(flavor.rawValue.capitalized)
    .tag(flavor)

```

* conform `Flavor` to `Identifiable` by providing a custom `id` of type `Flavor`:

```
var id: Flavor { self }

```

* specify the `id` parameter (of type `Flavor`) explicitly in the `ForEach`:

```
ForEach(Flavor.allCases, id: \.self) { ... }

```

* change the `selectedFlavor` to be a String:

```
@State private var selectedFlavor = Flavor.chocolate.rawValue

```
This is an addition to @pawello2222 already awesome answer.

Just to clarify that the solution to conform the enum to Identifiable using the below code works to correctly tag the UI picker without explicitly declaring it within the picker code:

```
var id: Flavor { self }

```

The official [Apple documentation for the swiftUI picker](https://developer.apple.com/documentation/swiftui/picker) says to id the enum using `var id: String { self.rawValue }` and does not work as expected using the rest of the example code.