Is it possible to shorten a group by clause so that you do not have to repeat the fields mentioned in the select clause ad nauseam? For example:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
field1,
field2,
field3,
field4
to:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
SELECT.*
…or something to this effect. I’m writing a query that will be utilizing the sp_executesql() stored procedure and I’m running out of space available in my variable. Thank you much.
are you looking for
SELECT DISTINCTorSELECT DISTINCTROW?