MySQL Forums
Forum List  »  General

Distinct is not working, but why?
Posted by: Johan Basberg
Date: April 03, 2005 08:14PM

Hi,

I can't quite understand why this is not working? I would think I would have a single item with each reference_id, even though I have more than one description to each reference. Feels like I am missing out on something obvious, but ... I am so tired I can hardly type.

So, can anyone tell me how to get only a single row based on the tables below?


/ Reference / / Description /
--------------- ---------------------
/ id / URL / / id / Txt / ref_URL
--------------- ---------------------
/ 1 / yyy / / 1 / Cool! / 1
/ 2 / xxx / / 2 / Bad! / 1
/ 3 / zzz / / 3 / Ok / 1

The result should be only ONE row:
/ yyy / Cool! /

Regards,
Johan


-- snip


SELECT DISTINCT(ref_URL) AS something_distinct,
URL,
TxT,
FROM Description, Reference
WHERE ref_URL = Reference.id
ORDER BY URL ASC

SELECT DISTINCT(description_reference) AS something_unique,
reference_uri AS uri,
description_description AS description,
description_title AS title,
description_score AS rating
FROM dv_reference
LEFT JOIN dv_description
ON description_reference = reference_id
ORDER BY description_title ASC

Options: ReplyQuote


Subject
Written By
Posted
Distinct is not working, but why?
April 03, 2005 08:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.