SQL execution returns different results than execution directly in MS SQL Server Management Studio
I have quite small experience with SQL, so maybe I am doing something wrong.
I was trying to build a query which will display results from several SELECT's. The code is quite large, but in general it goes like this:
Obroty.ART_CODE AS [Kod Kategorii],
Obroty.COL_CODE AS [Kod Wariantu],
(and so on.....)
(SELECT ROTAT.ART_CODE, ROTAT.COL_CODE, Sum(ROTAT.QUANTITY) AS Sum_QUANTITY
GROUP BY ROTAT.ART_CODE, ROTAT.COL_CODE) Obroty
INNER JOIN CARDS_ITE ON CARDS_ITE.ART_CODE = Obroty.ART_CODE AND CARDS_ITE.COL_CODE = Obroty.COL_CODE
INNER JOIN STOCK_WHS ON STOCK_WHS.ART_CODE = Obroty.ART_CODE AND STOCK_WHS.COL_CODE = Obroty.COL_CODE
and so on, more inner joins.
The problem is, that FlySpeed SQL Query returns different data than MS SQL SM Studio (seems sub-queries are not joined correctly on two conditions)
In general FlySpeed gives those results (dataset '990020' and '0' in two first columns does not even exist for sum of quantities = 204):
While MS SQL SM Studio returns correctly:
I don't have nearly enough experience to say what's wrong, but two programs giving different results on identical SQL query seems strange to me.
Other that this - I really appreciate Your work with FlySpeed, great program!