There are no duplicates in your results
Distinct is on the whole record not on the individual Items
for example:
| Xerox N-2125 | Xerox DC255 |
is not the same as
| Xerox N40 | Xerox DC255 |
because the first field is different
and
| Xerox N-2125 | Xerox DC255 |
is not the same as
| Xerox N-2125 | Xerox 4LP |
because the second field is different
You could do something like
SELECT DISTINCT namep,Max(namef) FROM printers,fax WHERE namep LIKE 'Xerox%'
AND
nomef LIKE 'Xerox%'
GROUP BY namep;
but you will be missing some values of namef
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 06, 2001 11:08 AM
To: [EMAIL PROTECTED]
Subject: SELECT DISTINCT
Hi. I need to do a search like this
SELECT DISTINCT namep,namef FROM printers,fax WHERE namep LIKE 'Xerox%' AND
nomef LIKE 'Xerox%';
I had in the database data like Xerox N-2125 or Xerox N17.
I think I must use a "subselect" or something like because i get duplicate
results. Any help will be helpfull. Thanks in advance.
Results:
+--------------+-------------+
| namep | namef |
+--------------+-------------+
| Xerox N-2125 | Xerox DC255 |
| Xerox N17 | Xerox DC255 |
| Xerox N40 | Xerox DC255 |
| Xerox N-2125 | Xerox 4LP |
| Xerox N17 | Xerox 4LP |
| Xerox N40 | Xerox 4LP |
+--------------+-------------+
---------------------------------------------------------------------
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
---------------------------------------------------------------------
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