[erlang-questions] learning mnesia:select syntax
Håkan Huss
huss01@REDACTED
Fri Oct 5 09:15:15 CEST 2007
On 10/5/07, Richard Andrews <bbmaj7@REDACTED> wrote:
>
> MatchHead = #employee{name='$1', sex=male, room_no={'$2', '_'}, _='_'},
> Guard = [{'>=', '$2', 220},{'<', '$2', 230}],
> Result = '$1',
> mnesia:select(employee,[{MatchHead, Guard, [Result]}])
>
> I want to modify this to return {name, sex} of every employee with the same
> Guard.
>
> MatchHead is easy change sex='$3'.
>
> Now what do I do with Result if I want to get back multiple fields.
Result = {{'$1','$3'}},
Perhaps not obvious, but read the match spec information in the ERTS user guide.
Regards,
/Håkan
More information about the erlang-questions
mailing list