This project has moved. For the latest updates, please go here.

get records via "or" criteria

Jul 10, 2014 at 7:28 PM
Hi ,

I have a table in esent db:

Id Value Message
1 55 "Message1"
2 68 "Message2"
3 70 "Message3"
4 55 "Message4"
5 14 "Message5"

I need query:

SELECT * FROM table where (Value = 68) or (Value = 55)

Which indexes do I need?
What calls "Api.MakeKey" and "Api.TrySeek" do I need ?
Developer
Jul 21, 2014 at 11:23 PM
You probably need to create an index over 'Value'. Will the 'Value's be unique or not? The following is off the top of my head:
Api.JetSetCurrentIndex()
Api.MakeKey( ..., 68, NewKey );
Api.TrySeek( ..., EQ );
// May need to do Api.TryMoveNext() if it's a non-unique index.
Api.MakeKey( ..., 55, NewKey );
Api.TrySeek( ..., EQ );
Does that make sense?
-martin