I've found a few things about hiding columns in queries, but none of them have worked.
In my query below, I don't want the "NextRow" to display in the output.
SELECT *
FROM (SELECT *, LAG([Cupola_Charge_Counter]) OVER (ORDER BY DateTime) NextRow
FROM OPENQUERY(INSQL,
'SELECT DateTime, [Cupola_Charge_Counter], [Cupola_Charge_Steel], [Cupola_Charge_Cast], [Cupola_Charge_Remelt], [Cupola_Charge_Pig], [Cupola_Charge_Borings]
FROM WideHistory
WHERE wwRetrievalMode = ''Full''
AND wwVersion = ''Latest''
AND DateTime >= DateAdd(hh,-24,GetDate())
AND DateTime <= GetDate()')
) X
WHERE NextRow <> [Cupola_Charge_Counter]
ORDER BY DateTime DESC
You are using *
. That is shorthand for all rows. If you only want certain rows, then instead of using *
, specify which rows you want. Example:
SELECT id, name, phone FROM...