I have seen this error message many times here, but I am not getting a solution to my specific problem (perhaps because I am not an sql expert), so please forgive me for sending the question to the same error.
This is the query I'm trying to execute:
SELECT DISTINCT U.FB_UserId
, U.Id AS GameUserID
, U.FbLocale
, U.FbGender
, U.FbBirthday
, U.RegistredAt
, U.LoginCount
, U.PlayCount
, U.MarketGroupId
, (SELECT COUNT(C.PriceFbCredits)
WHERE UserID = U.Id) AS Payments
, (SELECT SUM(CASE WHEN C.PriceFbCredits = 13 THEN 1 END)
WHERE UserID = U.Id) AS P13
, (SELECT SUM(CASE WHEN C.PriceFbCredits = 52 THEN 1 END)
WHERE UserID = U.Id) AS P52
, (SELECT SUM(CASE WHEN C.PriceFbCredits = 130 THEN 1 END)
WHERE UserID = U.Id) AS P130
FROM [dbo].[User] AS U WITH (NOLOCK) INNER JOIN [dbo].[FbCreditsCallback] AS C WITH (NOLOCK) ON C.UserId = U.Id
If yes, I get an error. Well, I know what this means, and I understand what to do, but I think that if I do this, it will not give me the result that I want ... I need some data for a certain one userid. some data must be summarized, some of them must be calculated, and each identifier should appear only once in the list of results.
( ). SELECT-Queries, , . , :
, (SELECT COUNT(PriceFbCredits)
FROM [dbo].[FbCreditsCallback]
WHERE UserID = U.Id) AS Payments
... , , .