3

I want to do a SELECT DISTINCT guid, ..., but I don't want guid appearing in the recordset. How do I do this?

user151841
  • 17,377
  • 29
  • 109
  • 171

4 Answers4

5
SELECT a.Field2
     , a.Field3
  FROM (SELECT DISTINCT a.guid
                      , a.Field2
                      , a.Field3
                   FROM table1 a)  a
dcp
  • 54,410
  • 22
  • 144
  • 164
3

You can also do

SELECT x, y FROM tbl GROUP BY guid, x, y

The drawback here is that you have to duplicate the column list in the GROUP BY clause, which is annoying, but the other answers do as well.

egrunin
  • 24,650
  • 8
  • 50
  • 93
2

Wrap it in a subselect?

select my, interesting, columns
from (
    select distinct GUID, ...
    from ...
)
meriton
  • 68,356
  • 14
  • 108
  • 175
0

select the distinct values into a temp table first.

Then select out only the values you want.

sparkkkey
  • 158
  • 1
  • 10