I am new to erlang. I have following data record.
-record(tracked_connection, {id,node,vhost,name,pid,protocol,type,peer_host,peer_port,username,connected_at}).
I need to select data in following SQL format
Select * from tracked_connection where username = 'xxxxx';
All rows can get following code.
mnesia:select(Tab,[{'_',[],['$_']}]).
How I achieve my requirement.
You can do it like this:
mnesia:select(Tab,[{#tracked_connection{username = "xxxxx", _ = '_'},[],['$_']}]).
That is, in the match spec, the username field of the record must match "xxxxx", while all other fields can be anything.