B
B-SQL
Hi, I am a novice with Access, so there might be an easier
way other than SQL.
I created the tables as you indicated a solution would be
to include a DISTINCT in your selection and to NOT
DISPLAY your keywords in the results. If you can live
without showing the results of the key word search, you
should be able run it quickly in this manner and it will
eliminate duplicates while allowing multiple books with
the same keywords.
SELECT distinct(tblLibData.title) AS title,
tblLibData.author, tblLibData.subject
FROM tblLibData INNER JOIN tblKeyData ON
tblLibData.IndexID = tblKeyData.indexID
WHERE (((tblKeyData.keyword) Like ("*" & [Enter Key Word]
& "*")));
one table called tblLibData. Each record in this table is
given an autonumber called IndexID. I have another table
that is joined to the first table (called tblKeyData) that
contains an IndexID field linked to the first tables'
IndexID field, and a Keyword field so that each book
(IndexID) has a set of keywords associated with it. What
I'm trying to do is make a query that get's an inputed
keyword from a form, searches tblKeyData for a keyword
(basically the form input + a wildcard, so that it
searches for anything starting with what the user inputs)
and outputs the results. The problem I'm having is that
when someone inputs a word, it will sometimes output the
book record more than once.
Location from tblLibData more than once. I want it to just
show a record once, even though it may find the
word "roller" in 3 keywords of the same record.
the following code from the Keyword criteria for the Find
Duplicates query into my search query under the Keyword
criteria:
time to load.
way other than SQL.
I created the tables as you indicated a solution would be
to include a DISTINCT in your selection and to NOT
DISPLAY your keywords in the results. If you can live
without showing the results of the key word search, you
should be able run it quickly in this manner and it will
eliminate duplicates while allowing multiple books with
the same keywords.
SELECT distinct(tblLibData.title) AS title,
tblLibData.author, tblLibData.subject
FROM tblLibData INNER JOIN tblKeyData ON
tblLibData.IndexID = tblKeyData.indexID
WHERE (((tblKeyData.keyword) Like ("*" & [Enter Key Word]
& "*")));
information such as Title, Author, Subject and Location in-----Original Message-----
I am making a table for a library database, and I have
one table called tblLibData. Each record in this table is
given an autonumber called IndexID. I have another table
that is joined to the first table (called tblKeyData) that
contains an IndexID field linked to the first tables'
IndexID field, and a Keyword field so that each book
(IndexID) has a set of keywords associated with it. What
I'm trying to do is make a query that get's an inputed
keyword from a form, searches tblKeyData for a keyword
(basically the form input + a wildcard, so that it
searches for anything starting with what the user inputs)
and outputs the results. The problem I'm having is that
when someone inputs a word, it will sometimes output the
book record more than once.
input, it would return the Title, Subject, Category, andHere is a sample set of records from tblKeyData to illustrate my problem:
IndexID Keyword
6 roller bearings
6 roller followers
6 rollers
8 roller bearings
8 hand tools
So if I were to input the word "roller" into the form's
Location from tblLibData more than once. I want it to just
show a record once, even though it may find the
word "roller" in 3 keywords of the same record.
Duplicates query for tblKeyData and copying and pastingI actually fixed this problem by creating a Find
the following code from the Keyword criteria for the Find
Duplicates query into my search query under the Keyword
criteria:
search from the form, it runs VERY slowly and takes a longIn (SELECT [Keywords] FROM [tblKeyData] As Tmp GROUP BY [Keywords] HAVING Count(*)>1 )
The only problem is that when I actually perform the
time to load.