SQL查询出错了

时间:2017-10-31 17:56:13

标签: mysql sql view where

我在这里做错了什么?此查询结果为0行。状态表是一个int类型

CREATE OR replace view ACTIVE_GROUPS AS
SELECT id, name, status
FROM test1.group
WHERE status != 2 group by id

2 个答案:

答案 0 :(得分:0)

也许你并不打算在test1结尾处放置.group? 您也可能不需要SELECT id, name, status FROM test1 WHERE status != 2 group by id ,这取决于您的尝试。

SELECT
    b.[User ID]
    , b.[Points]
    , b.[Date Field]
    , SUM(a.Points) [Total Points]
FROM
    #Temp b
    INNER JOIN Main_Table a ON b.[User ID] = a.[User ID]
GROUP BY
    b.[User ID]
    , b.[Points]
    , b.[Date Field]

答案 1 :(得分:0)

sqlservr.exe