473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question involving OLE DB, recursion, and filtered views

I have a programming problem in OLEDB and C++ that seems to be pointing me
toward using layered views and hierarchical rowsets. However, I am uncertain
of the precise implementation and need guidance from someone experienced in
those areas.
The problem, in the abstract, is how to select a set of records in one
table, each one of which has a relation to every one of a set of records in
another table, the tables being joined in a many-to-many relationship.

To illustrate, consider two tables, Boys and Girls, each comprising a Name
and ID column, and a junction table BG, comprising two columns BoyID and
GirlID, thus joining the two tables Boys and Girls. A given Boy (record) has
a relationship with a given Girl record if the BG table contains a record
containing the respective keys.

The relationship is described as "friendship" but you may use your
imagination; it will help to understand the problem.

In any case, friendship may only take place between Boys and Girls. Each Boy
may have been friendly with zero or any arbitrary number of Girls; the
reverse is true for the Girls to Boys. The following sample data will
illustrate:

BOYS
----
ID Name
----+---------------
1 |Adam
2 |Bill
3 |Charles
4 |Dick
5 |Randy

GIRLS
-----
ID Name
----+---------------
1 |Ann
2 |Betsy
3 |Cathy
4 |Ellen
5 |Floozy
6 |Virginia

BG (Boys-Girls)
-------------------------------------------
1 1 (Adam + Ann were friendly at least once)
1 2 (Adam + Betsy "")
1 5 (Adam + Floozy "")
2 1 (Bill + Ann)
2 3 (Bill + Cathy)
2 5 (Bill + Floozy)
3 4 (Charles + Ellen)
3 5 (Charles + Floozy)
4 1 (Dick + Ann)
4 2 (Dick + Betsy)
4 3 (Dick + Cathy)
4 4 (Dick + Ellen)
4 5 (Dick + Floozy)

Randy and Virginia have no relations with anyone, hence their names.

Now, the final objective is to be able to ask a question like this:
"Given a list of names of boys, what are the names of the girls who have
been friendly with ALL of the boys in that list?" For example, if we were to
supply a list with the single name of "Adam", we would get the list (Ann,
Betsy, Floozy). Querying with the names (Bill, Dick), we would get the list
(Ann, Cathy, Floozy), because they are joined to each one of (Bill, Dick).
If we were to supply the list (Adam, Bill, Charles) we would get the list
containing only the name Floozy, because she is the only girl who has (had)
relations with each of the boys in the supplied list. Supplying Randy with
any or no other boys' names would get an empty list, because he has no
relations.

Simple enough. It is trivial to concoct a query to find matches on a list
with just one name:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and \
BG.BoyID = Boys.ID and Boys.Name = (?)

(If you like JOIN syntax it is even easier)

Extending this to a query for two names is not much harder:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and \
BG.BoyID = Boys.ID and Boys.Name = (?) and Girls.Name IN
(SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID
and \
BG.BoyID = Boys.ID and Boys.Name = (?))

One could in principle extend this indefinitely ... but this is ugly enough
as it is.
As a solution to the original problem - that is, how to do this with an
essentially arbitrarily long list of boys - it is basically infeasible,
especially if you are constructing accessors and queries in C++ on the fly.
Yuck.

So, it dawned on me that the thing to do is use views: Get essentially the
entire set of relations, then filter the results repetitively (or
recursively) through views to get the subset of Girls with relations to
each Boy in the list. This is where I am stuck (in the first place, this
might not be the easiest way to deal with this problem. If there is a better
overall approach please point it out).

In the first blush, I could join all the records on their relations in the
BG table, then filter the resultant rowset:

CCommand<MyAccessor> pCmd;
char * sQryString = \
"SELECT * from Boys, Girls, BG, where Boys.ID = BG.BoyId and
BG.GirlID = Girls.ID;"
.... blah ... QI(&pCmd), etc. ....
hr = pCmd->Open(session, .., sQryString, etc.);

....and then...

CComPtr<IUnknown> pView;
CComPtr<IRowsetView> pRowsetView;
CComPtr<IViewFilter> pViewFilter;
CComPtr<IViewChapter> pViewChapter;

hr = pCmd->m_spRowset->QueryInterface(&pView);
hr = pCmd->m_spRowset->QueryInterface(&pRowsetView);
hr = pRowsetView->CreateView(0, IID_IViewFilter, (IUnknown **)&pViewFilter);
hr = pViewFilter->QueryInterface(&pViewChapter);

Now I have a chapter and a filter. Now I want to filter for all the records
that contain the first of my list of names. Supposing my list is (Adam,
Dick), I will construct a filter on that name (I omit the details). This
yields a view rowset containing Adam's name and ID joined to the names and
IDs of each of his partners. I would now like to know essentially the
following:

What is the subset of Girl's names within the above list, which also have
relations with Dick?

How can I construct a view/chaptered rowset which will give me this
information? If I filter again on the Boys.Name on the view I just got, I
will get an empty result set, because every boys' name in the resultant set
will be Adam, and filtering again on equality with Dick will come up empty.

Basically, I need to know how to take the resultant rowset and use it as
input in another query.

And I need to do it against a Jet backend, using OLE DB, from C++.

Thanks in advance.

RDeW
Nov 13 '05 #1
9 1986
"Riley DeWiley" <ri***********@gmail.com> wrote in
news:10************@corp.supernews.com:
Now, the final objective is to be able to ask a question like this:
"Given a list of names of boys, what are the names of the girls who
have been friendly with ALL of the boys in that list?" For example, if
we were to supply a list with the single name of "Adam", we would get
the list (Ann, Betsy, Floozy). Querying with the names (Bill, Dick),
we would get the list (Ann, Cathy, Floozy), because they are joined to
each one of (Bill, Dick). If we were to supply the list (Adam, Bill,
Charles) we would get the list containing only the name Floozy,
because she is the only girl who has (had) relations with each of the
boys in the supplied list. Supplying Randy with any or no other boys'
names would get an empty list, because he has no relations.

Simple enough. It is trivial to concoct a query to find matches on a
list with just one name:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and
\
BG.BoyID = Boys.ID and Boys.Name = (?)

(If you like JOIN syntax it is even easier)


This can be extended to an arbitrary-sized list:

SELECT Girls.Name
FROM Girls
INNER JOIN BG ON Girls.ID = BG.GirlID
INNER JOIN Boys ON BG.BoyID = Boys.ID
WHERE Boys.Name IN ('Adam','Bill','Charles')
GROUP BY Girls.Name
HAVING COUNT(*) = 3

on the assumption that (BoyID,GirlID) is unique within BG (as it had
better be). All that needs to be parameterized is the IN list and the
number the count is compared to in the HAVING clause.
Nov 13 '05 #2

"Eric Bohlman" <eb******@omsdev.com> wrote in message
news:Xn****************************@130.133.1.4...
"Riley DeWiley" <ri***********@gmail.com> wrote in
news:10************@corp.supernews.com:
Now, the final objective is to be able to ask a question like this:
"Given a list of names of boys, what are the names of the girls who
have been friendly with ALL of the boys in that list?" For example, if
we were to supply a list with the single name of "Adam", we would get
the list (Ann, Betsy, Floozy). Querying with the names (Bill, Dick),
we would get the list (Ann, Cathy, Floozy), because they are joined to
each one of (Bill, Dick). If we were to supply the list (Adam, Bill,
Charles) we would get the list containing only the name Floozy,
because she is the only girl who has (had) relations with each of the
boys in the supplied list. Supplying Randy with any or no other boys'
names would get an empty list, because he has no relations.

Simple enough. It is trivial to concoct a query to find matches on a
list with just one name:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and
\
BG.BoyID = Boys.ID and Boys.Name = (?)

(If you like JOIN syntax it is even easier)


This can be extended to an arbitrary-sized list:

SELECT Girls.Name
FROM Girls
INNER JOIN BG ON Girls.ID = BG.GirlID
INNER JOIN Boys ON BG.BoyID = Boys.ID
WHERE Boys.Name IN ('Adam','Bill','Charles')
GROUP BY Girls.Name
HAVING COUNT(*) = 3

on the assumption that (BoyID,GirlID) is unique within BG (as it had
better be). All that needs to be parameterized is the IN list and the
number the count is compared to in the HAVING clause.


Hmm, had not thought of that. Are you aware of any upper bound on the number
of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.

There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names. For
example, I would like to match girls' names as LIKE 'Ann*' to get Ann, Anna,
Annemarie, etc. But that is another question.
Nov 13 '05 #3
"Riley DeWiley" <ri***********@gmail.com> wrote in message news:<10************@corp.supernews.com>...

[...]
Now, the final objective is to be able to ask a question like this:
"Given a list of names of boys, what are the names of the girls who have
been friendly with ALL of the boys in that list?" For example, if we were to
supply a list with the single name of "Adam", we would get the list (Ann,
Betsy, Floozy). Querying with the names (Bill, Dick), we would get the list
(Ann, Cathy, Floozy), because they are joined to each one of (Bill, Dick).
If we were to supply the list (Adam, Bill, Charles) we would get the list
containing only the name Floozy, because she is the only girl who has (had)
relations with each of the boys in the supplied list. Supplying Randy with
any or no other boys' names would get an empty list, because he has no
relations.


What you are looking for is called relational division. SQL does not
directly support queries like "gimmie the names of boys that has
relationships with all girls". Instead you have to rephrase your
question as "gimme the names of boys where it does not exist girls
that he doesnt have a relationship with". If you google for Celko and
hangar in comp.database.* you will find a post that illustrates this
in a nice way.

In your case the query would look something like

select boy_id, name from boys b
where not exists (
select 1 from girls g
where not exists (
select 1 from BG
where (boy_id, girl_id) = (b.boy_id, g.girl_id)
)
)

Other things to concider is whether a has a relationship with b
implies that b also have a relationship with a. If you dont want to
record a relationship twice you could create a view like

create view relates_to as (
select boy_id, girl_id from bg
union
select girl_id, boy_id from bg
)

and use that in your query. Finally, it is easier for people to help
you if you provide ddl and insert statements instead of ascii tables.
I.e.

create table boys (
boy_id int not null primary key
name char(10) not null
);

insert into boys values (1,'Adam'), (2,'Bill'), ...
HTH
/Lennart

[...]
Nov 13 '05 #4
I would prefer to use 2 tables, Persons with PersonID, names & sex, and a
second table of JoinPersonPerson which has a joint key of Person1ID and
Person2ID

That way you can a have homosexual relationships ( when I say you, I am
speaking in the general sense) .

You have a form listing person1 and a subform listing person2.
Put whaterver search facilities you like on the main form. Colour it pink
for a girl and blue for a boy. You can even do conditional formatting on the
subform to show same sex relations.

HTH

Phil
"Riley DeWiley" <ri***********@gmail.com> wrote in message
news:10************@corp.supernews.com...
I have a programming problem in OLEDB and C++ that seems to be pointing me
toward using layered views and hierarchical rowsets. However, I am
uncertain
of the precise implementation and need guidance from someone experienced
in
those areas.
The problem, in the abstract, is how to select a set of records in one
table, each one of which has a relation to every one of a set of records
in
another table, the tables being joined in a many-to-many relationship.

To illustrate, consider two tables, Boys and Girls, each comprising a Name
and ID column, and a junction table BG, comprising two columns BoyID and
GirlID, thus joining the two tables Boys and Girls. A given Boy (record)
has
a relationship with a given Girl record if the BG table contains a record
containing the respective keys.

The relationship is described as "friendship" but you may use your
imagination; it will help to understand the problem.

In any case, friendship may only take place between Boys and Girls. Each
Boy
may have been friendly with zero or any arbitrary number of Girls; the
reverse is true for the Girls to Boys. The following sample data will
illustrate:

BOYS
----
ID Name
----+---------------
1 |Adam
2 |Bill
3 |Charles
4 |Dick
5 |Randy

GIRLS
-----
ID Name
----+---------------
1 |Ann
2 |Betsy
3 |Cathy
4 |Ellen
5 |Floozy
6 |Virginia

BG (Boys-Girls)
-------------------------------------------
1 1 (Adam + Ann were friendly at least once)
1 2 (Adam + Betsy "")
1 5 (Adam + Floozy "")
2 1 (Bill + Ann)
2 3 (Bill + Cathy)
2 5 (Bill + Floozy)
3 4 (Charles + Ellen)
3 5 (Charles + Floozy)
4 1 (Dick + Ann)
4 2 (Dick + Betsy)
4 3 (Dick + Cathy)
4 4 (Dick + Ellen)
4 5 (Dick + Floozy)

Randy and Virginia have no relations with anyone, hence their names.

Now, the final objective is to be able to ask a question like this:
"Given a list of names of boys, what are the names of the girls who have
been friendly with ALL of the boys in that list?" For example, if we were
to
supply a list with the single name of "Adam", we would get the list (Ann,
Betsy, Floozy). Querying with the names (Bill, Dick), we would get the
list
(Ann, Cathy, Floozy), because they are joined to each one of (Bill,
Dick).
If we were to supply the list (Adam, Bill, Charles) we would get the list
containing only the name Floozy, because she is the only girl who has
(had)
relations with each of the boys in the supplied list. Supplying Randy
with
any or no other boys' names would get an empty list, because he has no
relations.

Simple enough. It is trivial to concoct a query to find matches on a list
with just one name:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and \
BG.BoyID = Boys.ID and Boys.Name = (?)

(If you like JOIN syntax it is even easier)

Extending this to a query for two names is not much harder:

SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and \
BG.BoyID = Boys.ID and Boys.Name = (?) and Girls.Name IN
(SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID
and \
BG.BoyID = Boys.ID and Boys.Name = (?))

One could in principle extend this indefinitely ... but this is ugly
enough
as it is.
As a solution to the original problem - that is, how to do this with an
essentially arbitrarily long list of boys - it is basically infeasible,
especially if you are constructing accessors and queries in C++ on the
fly.
Yuck.

So, it dawned on me that the thing to do is use views: Get essentially the
entire set of relations, then filter the results repetitively (or
recursively) through views to get the subset of Girls with relations to
each Boy in the list. This is where I am stuck (in the first place, this
might not be the easiest way to deal with this problem. If there is a
better
overall approach please point it out).

In the first blush, I could join all the records on their relations in the
BG table, then filter the resultant rowset:

CCommand<MyAccessor> pCmd;
char * sQryString = \
"SELECT * from Boys, Girls, BG, where Boys.ID = BG.BoyId and
BG.GirlID = Girls.ID;"
... blah ... QI(&pCmd), etc. ....
hr = pCmd->Open(session, .., sQryString, etc.);

...and then...

CComPtr<IUnknown> pView;
CComPtr<IRowsetView> pRowsetView;
CComPtr<IViewFilter> pViewFilter;
CComPtr<IViewChapter> pViewChapter;

hr = pCmd->m_spRowset->QueryInterface(&pView);
hr = pCmd->m_spRowset->QueryInterface(&pRowsetView);
hr = pRowsetView->CreateView(0, IID_IViewFilter, (IUnknown
**)&pViewFilter);
hr = pViewFilter->QueryInterface(&pViewChapter);

Now I have a chapter and a filter. Now I want to filter for all the
records
that contain the first of my list of names. Supposing my list is (Adam,
Dick), I will construct a filter on that name (I omit the details). This
yields a view rowset containing Adam's name and ID joined to the names and
IDs of each of his partners. I would now like to know essentially the
following:

What is the subset of Girl's names within the above list, which also have
relations with Dick?

How can I construct a view/chaptered rowset which will give me this
information? If I filter again on the Boys.Name on the view I just got, I
will get an empty result set, because every boys' name in the resultant
set
will be Adam, and filtering again on equality with Dick will come up
empty.

Basically, I need to know how to take the resultant rowset and use it as
input in another query.

And I need to do it against a Jet backend, using OLE DB, from C++.

Thanks in advance.

RDeW

Nov 13 '05 #5
> > This can be extended to an arbitrary-sized list:

SELECT Girls.Name
FROM Girls
INNER JOIN BG ON Girls.ID = BG.GirlID
INNER JOIN Boys ON BG.BoyID = Boys.ID
WHERE Boys.Name IN ('Adam','Bill','Charles')
GROUP BY Girls.Name
HAVING COUNT(*) = 3

on the assumption that (BoyID,GirlID) is unique within BG (as it had
better be). All that needs to be parameterized is the IN list and the
number the count is compared to in the HAVING clause.
Hmm, had not thought of that. Are you aware of any upper bound on the number
of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.

My idea is to create Boys_Name_List table. And insert names in each
row in the table.

There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names. For
example, I would like to match girls' names as LIKE 'Ann*' to get Ann, Anna,
Annemarie, etc. But that is another question.

I think Eric's query is basically "Relational Division".
Here are some another examples. You do not need count the number of
Boys beforehand.
(I tested them on DB2 UDB V8. So, some may not work on other DBMS.)

(Example 1)
SELECT Girls.Name
FROM Boys
INNER JOIN
Girls
ON Boys.Name IN ('Adam','Bill','Charles')
LEFT OUTER JOIN
BG
ON BG.BoyID = Boys.ID
AND BG.GirlID = Girls.ID
GROUP BY
Girls.Name
HAVING COUNT(Boys.ID) = COUNT(BG.GirlID);
(Example 2)
SELECT Girls.Name
FROM Girls
WHERE Girls.ID
IN (SELECT BG1.GirlID
FROM BG BG1
WHERE NOT EXISTS
(SELECT *
FROM Boys
WHERE Boys.Name IN ('Adam','Bill','Charles')
AND NOT EXISTS
(SELECT *
FROM BG BG2
WHERE BG2.GirlID = BG1.GirlID
AND BG2.BoyID = Boys.ID
)
)
);
(Example 3)
SELECT Girls.Name
FROM Girls
WHERE Girls.ID
NOT IN
(SELECT GirlID
FROM (SELECT Boys.ID, Girls.ID
FROM Girls
INNER JOIN
Boys
ON Boys.Name IN ('Adam','Bill','Charles')
EXCEPT ALL
SELECT *
FROM BG
) Q (BoyID, GirlID)
);
(Example 4)
SELECT GirlsName
FROM (SELECT Girls.Name, BG.BoyID
, ROWNUMBER() OVER(PARTITION BY Girls.ID ORDER BY
BG.BoyID DESC)
FROM Boys
INNER JOIN
Girls
ON Boys.Name IN ('Adam','Bill','Charles')
LEFT OUTER JOIN
BG
ON BG.BoyID = Boys.ID
AND BG.GirlID = Girls.ID
) Q (GirlsName, BoyID, rn)
WHERE rn = 1
AND BoyID IS NOT NULL;
Nov 13 '05 #6
Hi,

As Eric wrote, you would need to use IN clause to do this. But since IN
could be very long, you might face situation, when you SQL statement could
fail. If you are using SQL Server 200 in your case, then you could avoid
this problem creating stored procedure and pass list of the IN values as XML
string. Inside of this SP, you could query this XML inside of IN clause

--
Val Mazur
Microsoft MVP
"Riley DeWiley" <ri***********@gmail.com> wrote in message
news:10*************@corp.supernews.com...

"Eric Bohlman" <eb******@omsdev.com> wrote in message
news:Xn****************************@130.133.1.4...
"Riley DeWiley" <ri***********@gmail.com> wrote in
news:10************@corp.supernews.com:
> Now, the final objective is to be able to ask a question like this:
> "Given a list of names of boys, what are the names of the girls who
> have been friendly with ALL of the boys in that list?" For example, if
> we were to supply a list with the single name of "Adam", we would get
> the list (Ann, Betsy, Floozy). Querying with the names (Bill, Dick),
> we would get the list (Ann, Cathy, Floozy), because they are joined to
> each one of (Bill, Dick). If we were to supply the list (Adam, Bill,
> Charles) we would get the list containing only the name Floozy,
> because she is the only girl who has (had) relations with each of the
> boys in the supplied list. Supplying Randy with any or no other boys'
> names would get an empty list, because he has no relations.
>
> Simple enough. It is trivial to concoct a query to find matches on a
> list with just one name:
>
> SELECT Girls.Name from Boys, Girls, BG WHERE Girls.ID = BG.GirlID and
> \
> BG.BoyID = Boys.ID and Boys.Name = (?)
>
> (If you like JOIN syntax it is even easier)


This can be extended to an arbitrary-sized list:

SELECT Girls.Name
FROM Girls
INNER JOIN BG ON Girls.ID = BG.GirlID
INNER JOIN Boys ON BG.BoyID = Boys.ID
WHERE Boys.Name IN ('Adam','Bill','Charles')
GROUP BY Girls.Name
HAVING COUNT(*) = 3

on the assumption that (BoyID,GirlID) is unique within BG (as it had
better be). All that needs to be parameterized is the IN list and the
number the count is compared to in the HAVING clause.


Hmm, had not thought of that. Are you aware of any upper bound on the
number
of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.

There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names.
For
example, I would like to match girls' names as LIKE 'Ann*' to get Ann,
Anna,
Annemarie, etc. But that is another question.

Nov 13 '05 #7
Riley DeWiley wrote:
Hmm, had not thought of that. Are you aware of any upper bound on the number
of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.
In Access I passed about 15,000...maybe it was 12,000...elements in the
In clause. Very fast return of recs. I too was wondering what the
upper limit was. Perhaps the length of a string.
There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names. For
example, I would like to match girls' names as LIKE 'Ann*' to get Ann, Anna,
Annemarie, etc. But that is another question.

Nov 13 '05 #8
Wow, I don't need anywhere near 12,000, maybe twenty is fine. Thank you.

"Salad" <oi*@vinegar.com> wrote in message
news:Dz****************@newsread1.news.pas.earthli nk.net...
Riley DeWiley wrote:
Hmm, had not thought of that. Are you aware of any upper bound on the number of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.


In Access I passed about 15,000...maybe it was 12,000...elements in the
In clause. Very fast return of recs. I too was wondering what the
upper limit was. Perhaps the length of a string.

There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names. For example, I would like to match girls' names as LIKE 'Ann*' to get Ann, Anna, Annemarie, etc. But that is another question.

Nov 13 '05 #9

"Tokunaga T." <to*****@jp.ibm.com> wrote in message
news:81**************************@posting.google.c om...
This can be extended to an arbitrary-sized list:

SELECT Girls.Name
FROM Girls
INNER JOIN BG ON Girls.ID = BG.GirlID
INNER JOIN Boys ON BG.BoyID = Boys.ID
WHERE Boys.Name IN ('Adam','Bill','Charles')
GROUP BY Girls.Name
HAVING COUNT(*) = 3

on the assumption that (BoyID,GirlID) is unique within BG (as it had
better be). All that needs to be parameterized is the IN list and the
number the count is compared to in the HAVING clause.


Hmm, had not thought of that. Are you aware of any upper bound on the number of entries
in the IN (x, y, ....) clause? The list is potentially quite large, far
larger than in this contrived example.

My idea is to create Boys_Name_List table. And insert names in each
row in the table.

There is an additional complication, beyond the scope of the problem I
originally posted, in that I would like to get partial matches of names. For example, I would like to match girls' names as LIKE 'Ann*' to get Ann, Anna, Annemarie, etc. But that is another question.

I think Eric's query is basically "Relational Division".
Here are some another examples. .....


OK, that answers the original question, thanks to all who replied. That
question however was just a special case of the real problem, which is as
follows: Given a list of quarry names of the form ( Ann*, Betsy, Su*, *ny),
to mean "girls name LIKE Ann* or EQUALS Betsy or LIKE Su* or LIKE *ny". This
is a generalization of the problem I had originally posted, which implied
simple equality as being the operator in every case.

So, question #1 (How) can the solutions to the original question be
generalized to this problem?

Q2: Given that a goal is to avoid building complex queries and avoiding
complicated parameter binding issues (although I might yet do that), (how)
can I implement this as a filtered view into a rowset?

Thanks again to all who have replied.

RDeW
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: da Vinci | last post by:
Greetings. I want to get everyone's opinion on the use of recursion. We covered it in class tonight and I want a good solid answer from people in the "know" on how well recursion is accepted...
6
by: Noozer | last post by:
I'm developing a database using MS Access and have come across a problem. The majority of my database is pretty straightforward "many to one" relationships. I have one relationship that is...
4
by: Daniel | last post by:
I need to build the maze board(like 2d array) using a tree. But I find that my buildTree function doesn't work. Could anyone give me some hints on debugging it? Thanks bool BuildTree(TreeNodePtr...
3
by: Thaynann | last post by:
I ham tryin to access a website, the first time i send a GET to display the first page it displays the HTML code, but always with text "Enable Cookies In Your Browser", is there a way to have it...
6
by: Ray | last post by:
Hi all, While I use the ReportDocument of vb.net to set filter to the data to the Crystal Report, it is successful for the first time while running the program. However, for the second time while...
0
by: Ray | last post by:
Dear Bernie, Yes, if the same pfieldname is used. The same data will be filtered. But I only use the code shown you before. I have not used any dataset or datatable. How to fix the problem?...
10
by: Wildemar Wildenburger | last post by:
Hi there :) I don't know how else to call what I'm currently implementing: An object that behaves like a list but doesn't store it's own items but rather pulls them from a larger list (if they...
14
by: subramanian100in | last post by:
In the following link, http://www.c-faq.com/malloc/retaggr.html The following ANSWER is given to a question(comp.lang.c FAQ list · Question 7.5a) : Whenever a function returns a pointer, make...
35
by: Muzammil | last post by:
int harmonic(int n) { if (n=1) { return 1; } else { return harmonic(n-1)+1/n; } } can any help me ??
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.