Is it possible to return groups as an associative array? I would like to know if a pure SQL solution is possible. Please note that I am releasing that I could make things more complex unnecessarily, but this is mainly to give me an idea of ββthe power of SQL.
My problem: I have a list of words in the database that need to be sorted alphabetically and grouped into separate groups according to the first letter of the word.
For instance:
ape
broom
coconut
banana
apple
must be returned as
array(
'a' => 'ape', 'apple',
'b' => 'banana', 'broom',
'c' => 'coconut'
)
(.. "A" , ", B" b .. JavaScript, .. ( AJAX).
: PostgreSQL, MySQL , PostgreSQL. - PHP.