*DISTINCT omits data bases on selected fields only.  i.e. if you have
thousand rows having different dates in 'mydate' but all having year 2002,
then SELECT DISITNCT YEAR(mydate) will return only 1 row i.e. 2002.

* DISTINCTROW omits data based on entire duplicate records, not just
duplicate fields.

regds,
-----Original Message-----
From: Sheryl Canter [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 01:56
To: Juan Nin; [EMAIL PROTECTED]
Subject: Re: SELECT DISTINCT question


So depending on which columns you were looking at, two rows might seem
like
duplicates or not? If your SELECT statement only requested certain
fields,
your result set might have duplicates that wouldn't be duplicates if you
were looking at other columns as well? Is this correct?

So if I had this in a table:

pet     name     age
------------------------
dog    Spot      5
dog    Fluffy    5
cat     Clara     3

and I did

    SELECT DISTINCT pet, age

I'd get back just two rows.

If I did this:

    SELECT DISTINCT *

I'd get back all three rows.

Am I understanding this correctly?

    - Sheryl


mysql

----- Original Message -----
From: "Juan Nin" <[EMAIL PROTECTED]>
To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 2:42 PM
Subject: Re: SELECT DISTINCT question


From: "Sheryl Canter" <[EMAIL PROTECTED]>

> > DISTINCT removes duplicates: rows that are the same in *all*
columns.
>
> Would this be all columns in the table, or all columns retrieved by
the
> SELECT statement?

in the SELECT statement  :)

SELECTs do not alter your rows, you can only do that with update or
delete

regards,

Juan






---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to