Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql ents.setup、Clients.admin、temp.programmer) 按描述排序; 添加带有样本数据和预期输出的表结构。添加带有样本数据和预期输出的表结构。 SELECT Temp.description FROM ( ( _Sql_Sql Server_Union All - Fatal编程技术网

Sql ents.setup、Clients.admin、temp.programmer) 按描述排序; 添加带有样本数据和预期输出的表结构。添加带有样本数据和预期输出的表结构。 SELECT Temp.description FROM ( (

Sql ents.setup、Clients.admin、temp.programmer) 按描述排序; 添加带有样本数据和预期输出的表结构。添加带有样本数据和预期输出的表结构。 SELECT Temp.description FROM ( ( ,sql,sql-server,union-all,Sql,Sql Server,Union All,ents.setup、Clients.admin、temp.programmer) 按描述排序; 添加带有样本数据和预期输出的表结构。添加带有样本数据和预期输出的表结构。 SELECT Temp.description FROM ( ( SELECT Clients.aliasname AS description FROM ClientBilling INNER JOIN [B2BSetups].[dbo].Clients ON Cl

ents.setup、Clients.admin、temp.programmer) 按描述排序;
添加带有样本数据和预期输出的表结构。添加带有样本数据和预期输出的表结构。
SELECT Temp.description FROM (
    (
        SELECT Clients.aliasname AS description 
        FROM ClientBilling 
        INNER JOIN [B2BSetups].[dbo].Clients ON Clients.cno = ClientBilling.cno 
        WHERE programmerCreditDate >= '11/1/2016' 
            AND programmerCreditDate < '11/29/2016' 
            AND (ClientBilling.programmer='e21' or Clients.admin='e21' or Clients.setup='e21')
    )
    UNION ALL 
    (
        SELECT Clients.aliasname + ' - ' + TradingPartners.aliasname as description 
        FROM RelationshipBilling 
        INNER JOIN [B2BSetups].[dbo].TPRelationships ON TPRelationships.relno = RelationshipBilling.relno 
        INNER JOIN [B2BSetups].[dbo].Clients ON Clients.cno = TPRelationships.cno 
        INNER JOIN [B2BSetups].[dbo].TradingPartners ON TradingPartners.tpno = TPRelationships.tpno 
        WHERE programmerCreditDate >= '11/1/2016' 
            AND programmerCreditDate < '11/29/2016' 
            AND (RelationshipBilling.programmer='e21' or Clients.admin='e21' or Clients.setup='e21')
    )           
    UNION ALL 
    (
        SELECT Clients.aliasname + ' - ' + TradingPartners.aliasname + ' - ' + RelDocs.document as description 
        FROM DocumentBilling 
        INNER JOIN [B2BSetups].[dbo].RelDocs ON RelDocs.recid = DocumentBilling.docno 
        INNER JOIN [B2BSetups].[dbo].TPRelationships ON TPRelationships.relno = RelDocs.relno 
        INNER JOIN [B2BSetups].[dbo].Clients ON Clients.cno = TPRelationships.cno 
        INNER JOIN [B2BSetups].[dbo].TradingPartners ON TradingPartners.tpno = TPRelationships.tpno 
        WHERE programmerCreditDate >= '11/1/2016' AND programmerCreditDate < '11/29/2016' 
            AND (DocumentBilling.programmer='e21' or Clients.admin='e21' or Clients.setup='e21')
    )
) AS Temp 
ORDER BY description;
   SELECT Clients.aliasname +Temp.description  AS description,billedAmount FROM 
    (


        SELECT RelationshipBilling.programmer,TPRelationships.cno , ' - ' + TradingPartners.aliasname as description ,RelationshipBilling.billedAmount
        FROM RelationshipBilling 
        INNER JOIN [B2BSetups].[dbo].TPRelationships ON TPRelationships.relno = RelationshipBilling.relno 
        INNER JOIN [B2BSetups].[dbo].TradingPartners ON TradingPartners.tpno = TPRelationships.tpno 
        WHERE programmerCreditDate >= '11/1/2016' AND programmerCreditDate < '11/29/2016' 

        UNION ALL 
        SELECT ClientBilling.programmer, ClientBilling.cno,'' AS description,CONVERTNULL AS billedAmount FROM ClientBilling 
        WHERE programmerCreditDate >= '11/1/2016' AND programmerCreditDate < '11/29/2016' 
        UNION ALL 
        SELECT DocumentBilling.programmer,TPRelationships.cno, ' - ' + TradingPartners.aliasname + ' - ' + RelDocs.document as description ,NULL AS billedAmount
        FROM DocumentBilling 
        INNER JOIN [B2BSetups].[dbo].RelDocs ON RelDocs.recid = DocumentBilling.docno 
        INNER JOIN [B2BSetups].[dbo].TPRelationships ON TPRelationships.relno = RelDocs.relno 
        INNER JOIN [B2BSetups].[dbo].TradingPartners ON TradingPartners.tpno = TPRelationships.tpno 
        WHERE programmerCreditDate >= '11/1/2016' AND programmerCreditDate < '11/29/2016' 


    ) AS Temp 
    INNER JOIN [B2BSetups].[dbo].Clients ON Clients.cno = Temp.cno 
    WHERE 'e21' IN (Clients.setup,Clients.admin,temp.programmer)
    ORDER BY description;