0
我想對這個查詢行進行計數。請幫助如何計算高級查詢行
SELECT
CrmDesk.Request.*
FROM
CrmDesk.Request
INNER JOIN
CrmDesk.Customer ON CrmDesk.Request.CustomerId = CrmDesk.Customer.Id
WHERE
(CrmDesk.Customer.GroupeId = '84b4ea32-b39b-49d3-bb24-35fd933fc594')
AND (RequestStatus != 4)
AND CrmDesk.Request.CustomerId IS NOT NULL
AND RequestStatus != 4
UNION
SELECT
CrmDesk.Request.*
FROM
CrmDesk.Customer
INNER JOIN
CrmDesk.CustomerOrder ON CrmDesk.Customer.Id = CrmDesk.CustomerOrder.CustomerId
INNER JOIN
CrmDesk.Request ON CrmDesk.CustomerOrder.Id = CrmDesk.Request.OrderId
WHERE
(CrmDesk.Customer.GroupeId = '84b4ea32-b39b-49d3-bb24-35fd933fc594')
AND (RequestStatus != 4)
UNION
SELECT
*
FROM
[CrmDesk].[Request]
WHERE
UserFrom IS NOT NULL
AND RequestStatus != 4
AND OwnerId IS NOT NULL
AND UserFrom IN (SELECT Id FROM [Karbazi].[User]
WHERE Id = '84b4ea32-b39b-49d3-bb24-35fd933fc594'
AND RequestStatus != 4
UNION
SELECT Id FROM [Karbazi].[User]
WHERE ParentUserId = '84b4ea32-b39b-49d3-bb24-35fd933fc594')
OR OwnerId IN (SELECT UserId
FROM [CrmDesk].[Customer]
WHERE groupeId = '84b4ea32-39b-49d3-bb24- 35fd933fc594')
AND UserFrom IS NOT NULL
AND RequestStatus != 4
UNION
SELECT *
FROM [CrmDesk].[Request]
WHERE UserToDo IN (SELECT id
FROM [Karbazi].[User]
WHERE ParentUserId='84b4ea32-b39b-49d3-bb24-35fd933fc594'
OR id ='84b4ea32-b39b-49d3-bb24-35fd933fc594')
AND RequestStatus != 4
你的表格僅包含一列?否則你的工會不會工作。 –
什麼意思不起作用?告訴我們錯誤。 \t \t \t請仔細閱讀[**如何對向**](http://stackoverflow.com/help/how-to-ask) \t \t \t \t \t \t這裏是一個偉大的地方[* * START **](http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/),瞭解如何提高您的問題質量並獲得更好的答案。 –