隐藏sql查询输出中的列

时间:2017-09-26 05:26:43

标签: sql hide

SELECT 
    MProduct.ProductCode, MProduct.ProductName, COUNT(*) AS Ranges
FROM 
    TProblem 
FULL OUTER JOIN
    MProduct ON TProblem.ProductCode = MProduct.ProductCode 
GROUP BY  
    MProduct.ProductCode, MProduct.ProductName 
ORDER BY 
    Ranges DESC

这是我的查询,但我想隐藏输出中的Ranges

2 个答案:

答案 0 :(得分:3)

要维持结果的顺序,只需将计数从您的选择移到订单:

SELECT 
    MProduct.ProductCode, MProduct.ProductName
FROM 
    TProblem 
FULL OUTER JOIN
    MProduct ON TProblem.ProductCode = MProduct.ProductCode 
GROUP BY  
    MProduct.ProductCode, MProduct.ProductName 
ORDER BY 
    count(*) DESC

答案 1 :(得分:0)

我知道@marc_s的来源。看起来您正在尝试获取DISTINCT行列表

SELECT DISTINCT 
    MProduct.ProductCode, MProduct.ProductName
FROM 
    TProblem 
FULL OUTER JOIN
    MProduct ON TProblem.ProductCode = MProduct.ProductCode 
    MProduct.ProductCode, MProduct.ProductName 

或者

return Object.assign(state, action.propObj)