I have following command :
select *
from Books
JOIN Keys ON Books.Bnumber = Keys.Bnumber
where (
Books.Author1 like '%,%' and
Books.Author1 like '%,John%' or (
Books.Author2 like '%,John%' and
Books.Author2 like '%,%'
)
) and
Name1 like '%' and
Keys.Keyword like '%'
order by NAME1 ;
The query returns the same record multiple times.
The repeating parts in query (Books.Author1 like '%'
…) are needed, for my application requires it. ( I think it should have nothing to do with my problem)
What could cause this?
Best Answer
Variants:
It is variant 2.
You make a mistake while thinking that the records are duplicates. They differs - at least in
Keyword
field taken fromKeys
table.You may "compress" the output obtaining one book per recodset by grouping and concatenating all keys into one field with keys list separated by comma: