Selecting only one element from a table in Base

How can I select only one food per kid?

id | name   | food
---+--------+--------------------
 1 | Johnny | Pizza
 2 | Mary   | Hamburger
 3 | Kevin  | Ramen
 4 | Sally  | Cheese cake
 5 | Paul   | Pop-corn
 6 | Johnny | Fries
 7 | Kevin  | Orange juice
 8 | Mary   | Vanilla ice cream
 9 | Johann | Cheese pie
…

Do you want to select only one food or do you want to input only one combination of name and food?

Select: SELECT "name", MIN("food") FROM "table" GROUP BY "name"

Prevent directly while input values: Open table for editing, not for input data. Have a look for Index. Create a new index. Should contain “name”. Set this index to Unique.
(This will only work if there isn’t a duplicate “name”).

1 Like

Thank you! Thank you very much!