I have the same query in SQL Server Standard and Azure SQL (see below). But sadly they do not have the same outcome even though the data in the database is the same. Vraag (i.e. question) has 12 rows. One question is answered (userantwoord). On SQL Server it shows 12 questions in which one has id_antwoord. The others are Null. In Azure it only shows the question that is answered and leaves the rest out. When I only select questions with categories, it shows 12 questions.
SELECT vraag.i_d__categorie, vraag.i_d, vraag.niveau, vraag.omschrijving,
vraag.volgorde, vraag.code, vraag.gewicht, vraag.tekst, vraag.thema1,
vraag.thema2, vraag.thema3, vraag.thema4, vraag.thema5, vraag.thema6,
userantwoord.id_antwoord
FROM categorie
LEFT OUTER JOIN vraag
LEFT OUTER JOIN Users
INNER JOIN userantwoord
ON Users.UserId = userantwoord.Id_user
ON vraag.i_d = userantwoord.id_vraag
ON categorie.i_d = vraag.i_d__categorie
WHERE categorie.link = @Onderwerp AND vraag.niveau = @Niveau
AND ([Users].UserId = @UserID OR [Users].UserId is null)
ORDER BY vraag.volgorde
Userantwoord is defined as follows:
CREATE TABLE [dbo].[userantwoord](
[id] [uniqueidentifier] NOT NULL,
[id_antwoord] [uniqueidentifier] NULL,
[id_vraag] [uniqueidentifier] NULL,
[Id_user] [uniqueidentifier] NULL,
CONSTRAINT [PK_userantwoord] PRIMARY KEY CLUSTERED
with foreign keys on all the right places. Is there something I forgot to look? I searched the internet for differences between Azure en SQL server but couldn't find anything so basic.