Re: Re: MySQL query, using DISTINCT...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > 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@xxxxxxxxxxx' 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

Ah...
But if the user has downloaded 3 files, I need to know that.
distinct email alone, wouldn't pick that up...
Cheers for your help though, I'm getting there...!
Any other ideas?

*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux