Search code examples
sqlsql-order-bywindow-functions

HIDE Column in Select query?


Hi I'm trying to hide the TotalRank Column that gets displayed during my results because I only needed it in this query to help sort items. I don't need this information displayed.

SELECT TOP 15 G.CharacterName, G.JobCode, G.PvPExp, D.PVPWin, D.PVPLose, D.PVPGiveUp, RANK() OVER (ORDER BY TotalRank ASC ) as TotalRank
FROM PvPRanking as G
INNER JOIN PVPScores as D
ON G.CharacterID = D.CharacterID

Solution

  • You can use th following

    SELECT TOP 15 G.CharacterName, G.JobCode, G.PvPExp, D.PVPWin, D.PVPLose, D.PVPGiveUp
    FROM PvPRanking as G
    INNER JOIN PVPScores as D
    ON G.CharacterID = D.CharacterID
    ORDER BY  RANK() OVER (ORDER BY TotalRank ASC )