Just from qlc manual:<br><br>To return just a few answers cursors can be used. The following code returns no more than five answers using an ETS table for storing the unique answers: <br><br>C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})),<br>
R = qlc:next_answers(C, 5),<br>ok = qlc:delete_cursor(C),<br>R.<br><br><div class="gmail_quote">On Feb 8, 2008 9:06 AM, Ulf Wiger <<a href="mailto:ulf@wiger.net">ulf@wiger.net</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'd have to check on how to do it with QLC, but using<br>mnesia:select(Tab, MatchSpec, NObjs, Lock), you<br>can quite easily pull the N first objects from an<br>ordered_set table.<br><br>BR,<br>Ulf W<br><br>2008/2/8, Dave Bryson <<a href="mailto:daveb@miceda.org">daveb@miceda.org</a>>:<br>
<div><div></div><div class="Wj3C7c">> I apologize in advance for the newbie question!<br>><br>> I'm trying to treat an mnesia table as a FIFO queue. What I'd like to<br>> be able to do is pull X number of items off the head of the list<br>
> returned by a query. There's no conditional values to isolate the<br>> records - I just want the top X number of records.  Is there an<br>> efficient way to do this with qlc?<br>><br>> Thanks in advance!<br>
><br>> Dave<br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil