The structure of the table "testtable" is
id int primary key
productid int
attributeid int
value varchar(250)
where productid is the unique id of a product, attributeid is the unique id of attribute of a product e.g. size, quality,height, color and 'value' is the value for the attribute
i have to filter a result. I achieve the requirement by this query. But i am not able to make it in a query.
select a.* from dbo.testtable a
where a.attributeId=10 and a.[Value]='Romance'
and productId in
(
select productId
from
dbo.testtable where attributeId =7 and [Value]='Hindi'
)
Need help to build this query..
Look at using Hibernate Search which provides you with semantics of lucene based searching on a database. Alternatively look at luke and figure out how lucene has indexed your data. Play around with it and it will help you frame lucene queries as it gives you a deeper look into lucene indexing and searching.
I think you have to do this in two steps:
Step 1: extract product ids
You then need to extract the productId from the docs
Step 2: run query