在子查询中使用where和group

时间:2017-08-22 14:29:26

标签: sql sql-server tsql

下面是我的代码没有成功执行。任何建议将不胜感激。我无法排除故障,我想知道它是否只是放置?

这是我收到的错误消息:

np.array_equals(xx[i,j], (5,5,5))

这是我的代码:

xx == (5,5,5)

3 个答案:

答案 0 :(得分:1)

您应该使用MissionViewModel代替Int

IntWrapper

答案 1 :(得分:1)

您应该将SELECT列表中的所有列都放到GROUP BY(只有那些没有聚合的列)。在你的情况下 - 所有这些。

SELECT *  FROM   nwh_analytics.dbo.km_cmr_table a 
       LEFT JOIN (SELECT CASE 
                           WHEN location IN ( '03', '05', '11', '12', 
                                              '15', '20', '25', '32', 
                                              '41', '42', '49', '50', 
                                              '60', '71', '72', '81', '99' ) 
                         THEN 
                           'Non Facility' 
                           WHEN location = '*' THEN 'Facility' 
                           ELSE 'error' 
                         END AS LOC, 
                         fee_prov, 
                         fee_cpt, 
                         cpt_modifier, 
                         rate_a, 
                         rate_b, 
                         rate_c, 
                         pct 
                  FROM   prod.dbo.prov_fee_schedule 
                  WHERE  to_date >= '2017-01-01' 
                         AND fee_prov IN ( 'TUPP00' ) 
                  GROUP  BY CASE 
                              WHEN location IN ( '03', '05', '11', '12', 
                                                 '15', '20', '25', '32', 
                                                 '41', '42', '49', '50', 
                                                 '60', '71', '72', '81', '99' ) 
                 THEN 
                              'Non Facility' 
                              WHEN location = '*' THEN 'Facility' 
                              ELSE 'error' 
                            END,
                         fee_prov, 
                         fee_cpt, 
                         cpt_modifier, 
                         rate_a, 
                         rate_b, 
                         rate_c, 
                         pct 
              ) b 
              ON a.code = b.fee_cpt

答案 2 :(得分:0)

您可以使用MAX()。例如:$serverlist = get-content "c:\serverlist.txt" foreach ($server in $serverlist){ $Errors = Get-Eventlog -ComputerName $Server -LogName System -EntryType Error -after (get-date).AddMinutes(-20) | Where-Object {$_.EventID -eq '7036'} if($Errors.Length -gt 0){ Send-MailMessage -To test@test.com -From errors@test.com -Subject "ERRORS" -Body $ErrorEvents } } 在SELECT

下对语句进行分组