Hi,
I got a problem retrieving data from multiple tables.
My sql looks like this:
SELECT r.[Password], s.[Name]
FROM Publications p, Surveys s, Recipients r
WHERE
EXISTS(
SELECT * FROM Surveys WHERE s.[Name] LIKE 'Enkät 2008 Skolor%'
)
AND p.[Name] LIKE 'Publikation 2008%'
Here is how my tables look:
[dbo].[Surveys]
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL
[dbo].[Publications]
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[SurveyId] [int] NOT NULL
[dbo].[Recipients]
[Id] [int] IDENTITY(1,1) NOT NULL,
[Password] [varchar](20) NOT NULL,
[PublicationId] [int] NOT NULL
As my SQL is now I get 512 rows back and I want to get only 64.
I want to only get all password and the names of the surveys associated with that password.
Now I get one password associated with every survey.
I have no clue what I'm doing wrong?
I guess my explanation is pretty confusing right now so ask if there is something more you need to know!
Cheers,
Sogeking









Bookmarks