Simple OR query

Nov 12, 2013 at 10:29 AM
Edited Nov 12, 2013 at 10:30 AM
I apologize for asking a seemingly dumb question, but is there an elegant way to perform a very simple OR query ?

Let's assume a table with columns; Firstname, Lastname, Social Security Number, Marital Status and Age. Primary Index set on Social Security Number.

I understand how to construct queries for "Ages between 20 & 30" or queries for "Age > 50 AND Marital Status = 'Widowed'" but for life of me can't work out how to elegantly construct a simple query over one column, for example a search for Marital Status='Single' or Marital Status='Divorced' or Marital Status='Widowed' ?

Or do I have to perform three separate queries using the standard JetSetIndex, JetMakeKey, JetSeek palaver.
Developer
Nov 12, 2013 at 7:51 PM
The simplest is to do the three separate queries.
Or you could probably use JetIntersectIndexes. It's usually used with different indexes, but it may work with different JET_TABLEID's using the same index.

http://msdn.microsoft.com/en-us/library/gg269335(v=exchg.10).aspx
And there's a bit about the costs at: http://blogs.msdn.com/b/martinc/archive/2013/04/19/cost-of-jetintersectindexes.aspx


-martin