se dau 2 tabele:
CREATE TABLE [dbo].[test](
[cod] [varchar](50) NULL,
[value] [varchar](50) NULL
) ON [PRIMARY]
insert into test values ('genre','Sports')
insert into test values ('publisher','Provider1')
CREATE TABLE [dbo].[productsTest](
[genre] [varchar](50) NULL,
[title] [varchar](50) NULL,
[publisher] [varchar](50) NULL
) ON [PRIMARY]
insert into productsTest values ('Sports','Title1','Provider1')
insert into productsTest values ('Sports','Title1','Provider2')
insert into productsTest values ('Action','Title1','Provider1')
As dori un query care sa imi intoarca din productsTest doar prima inregistrare.
Am reusit doar cu un intersect
select p.*
from
test t,
productsTest p
where
t.cod= 'genre' and t.value = p.genre
intersect
select p.*
from
test t,
productsTest p
where
t.cod= 'publisher' and t.value = p.publisher
Se poate si altfel?
Ideea este ca vrea sa fac un search global, variabilele sa le primesc
intr-un XML si in functie de tipul lor sa intorc toate rezultatele
valide.
Cristi