Let's imagine we have a query like:
SELECT id,key1
FROM my_table
WHERE condition = true
ORDER BY id
And this gives as a result the following array:
[
[id => 123, key1 => 'A'],
[id => 234, key1 => 'B'],
[id => 546, key1 => 'C']
]
The array has 3 values. The index of the row with key1='B'
is 1.
Is there a way to get the '1'
directly from a query?