Jump to content

[SOLVED] Problem with distinct...


kobbe

Recommended Posts

I have a table with: id, email, typeofmember, somethingelse

 

I need to select DISTINCT email and so only email field got selected by DISTINCT.

 

When I do:

SELECT DISTINCT email, typeofmember, somethingelse FROM table;

I still don\'t get \"unuiqe\" email...

 

After reading alot of posts here I\'ve tested this:

$temp = mysql_query ("CREATE TEMPORARY TABLE temp_email_db AS SELECT DISTINCT email FROM fint_mail_db WHERE mailtyp=$mailtyp");

$result = mysql_query ("SELECT a.email AS email, a.mailtyp AS mailtyp, a.id_code AS id_code, a.id AS id FROM fint_mail_db AS a, temp_email_db AS b WHERE a.email=b.email");

$temp = mysql_query ("DROP TABLE temp_email_db"); 

 

But that does not work either cause I need it by id... and if I do it by id email doesn\'t get distinct :)

 

I need help ;)

 

Thx in advance, sry for my bad explaining...

 

 

Edit:

WIIIIIIIIII =) I did it =) *happy again*

 

SELECT email, mailtyp, id_code, id FROM fint_mail_db GROUP BY email ORDER BY email
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.