Re: Re: MySQL query, using DISTINCT...
| From: | zareef ahmed | Date: | Tue, 06 Jul 2004 12:05:45 +0000 |
| Subject: | Re: Re: MySQL query, using DISTINCT... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35135@lists.php.net to get a copy of this message | ||
Hi,
using "group by" can also be usefull.
zareef ahmed
--- Torsten Roehr <roehr@zilleon.com> wrote:
> "Tristan Pretty" <Tristan.Pretty@risk.sungard.com>
> wrote in message
>
news:OF5F296513.2C519A0D-ON80256EC9.003688DB-80256EC9.0037BC5C@risk.sungard.
> com...
> > I have a system that tracks downloads, capturing
> loadsa info, but of
> > interest here, is email and filename.
> > Simply put, I wanna show all results where file
> name AND email are unique.
> > (so if email '123@hotmail.com' has filename
> 'word.doc' 5 times in a table,
> > I want to only see it once.)
> >
> > What am I doing wrong...?
> >
> > SELECT DISTINCT(file_name, email) FROM
>
completed_downloads WHERE bu =
> > 'reech' AND date BETWEEN '2004-06-01' AND
> '2004-06-30'
> >
> > Tris...
>
> Hi Tristan,
>
> I'm not an MySQL expert but DISTINCT removes
> duplicate *rows* from your
> result set. As you select email AND file_name you
> will always have a unique
> row (combination of email and file_name). Try
> without specifying file_name:
>
> SELECT DISTINCT email FROM completed_downloads
> WHERE bu = 'reech' AND
> date BETWEEN '2004-06-01' AND '2004-06-30'
>
> Regards, Torsten Roehr
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail