Have a Select component return the value of another database column

I have a Select control that's populated with values from column c2. I would like to have it return the corresponding row value in column c1.

c1 c2
1 Finance
2 Marketing
3 Development

So when the user selects Marketing, I want the control to return the value 2. How can I achieve this?

Try the following

select c1, c2 from random
Populate the dropdown with the result of the query as above in the screen shot.

The text field is just there to show the value selected...

1 Like