They should return the same values, but possibly in a different order.
SELECT foo, bar, baz FROM table GROUP BY foo, bar, baz;
returns the values of foo, bar, and baz, once for each unique combination,
ordered by foo, bar, baz. That is, GROUP BY does a free ORDER BY.
SELECT DISTINCT foo, bar,
- Original Message -
From: "Scott Haneda" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 15, 2004 8:12 PM
Subject: Group by and results
> Are these 2 statements the same?
>
> tSql1 = select distinct foo, bar, baz from table
>
Are these 2 statements the same?
tSql1 = select distinct foo, bar, baz from table
tSql2 = select foo, bar, baz from table group by foo, bar, baz
Why would I get different results?
--
-
Scott HanedaTel: 41