Hello List,
Please forgive this rather lengthy post. I thought I had something worked
out to answer Rob's question but when I put it to the test I found what MAY
be a bug in 4.1.1a-alpha-nt-log. Here is what I did.
I created two tables, tablea and tableb. Here are their defs:
mysql> show create
Thank you!!!
It works.
Hector
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2003 1:44 PM
To: Personal
Cc: [EMAIL PROTECTED]
Subject: Re: SELECT DISTINCT question
SELECT
cc:
Subject: SELECT DISTINCT question
10/13/2003
Hello everybody:
I have the following scenario:
I have a database of products, each of those products have a product number
(like 04543000). Now the first five digits represent the product number, and
the 2 following digits represent a differet color for the same product.
PROTECTED]>; "'Juan Nin'"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, March 01, 2003 3:46 AM
Subject: RE: SELECT DISTINCT question
*DISTINCT omits data bases on selected fields only. i.e. if you have
thousand rows having different dates in 'my
duplicate fields.
regds,
-Original Message-
From: Sheryl Canter [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 01:56
To: Juan Nin; [EMAIL PROTECTED]
Subject: Re: SELECT DISTINCT question
So depending on which columns you were looking at, two rows might seem
like
duplicates or no
this correctly?
- Sheryl
mysql
- Original Message -
From: "Juan Nin" <[EMAIL PROTECTED]>
To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 2:42 PM
Subject: Re: SELECT DISTINCT question
From: "Sheryl Ca
or your help.
>
> - Sheryl
>
>
> - Original Message -
> From: "Frank Peavy" <[EMAIL PROTECTED]>
> To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, February 28, 2003 11:22 AM
> Subject: Re: SELECT D
> From: "Sheryl Canter" <[EMAIL PROTECTED]>
>
> > > DISTINCT removes duplicates: rows that are the same in *all* columns.
> >
> > Would this be all columns in the table, or all columns retrieved by the
> > SELECT statement?
in the SELECT statement :)
SELECT queries do not alter your rows, you
L PROTECTED]>
To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
"Frank Peavy" <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 12:34 PM
Subject: Re: SELECT DISTINCT question
At 11:50 -0500 2/28/03, Sheryl Canter wrote:
>Frank,
>
>Sorry tha
up so I
can identify which author name to display.
Thanks for your help.
- Sheryl
- Original Message -
From: "Frank Peavy" <[EMAIL PROTECTED]>
To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 11:22 AM
S
Sheryl,
I'm trying to determine which author has the highest royalty percent FOR
EACH PROGRAM, not overall. I'm displaying a list of programs and authors,
and when there is more than one author, I want to show the principal author
(i.e., the one earning the highest royalty percent).
Ok, so your des
t: Friday, February 28, 2003 7:58 AM
Subject: Re: SELECT DISTINCT question
> Tore,
>
> Thanks very much for this. Question: Is it better to use INNER JOIN than a
> WHERE clause (for readability)? They do the same thing, don't they?
>
> I will try this out as soon as a finish a
others know of other ways of handling this.
- Sheryl
- Original Message -
From: "Tore Bostrup" <[EMAIL PROTECTED]>
To: "Sheryl Canter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 1:41 AM
Subject: Re: SELECT DISTINCT quest
;
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 11:49 AM
Subject: SELECT DISTINCT question
> I need help with a query. I have a 'royalties' table that looks like this:
>
> AuthorIDProgramIDRoyalty
> --
> Aut
on this list showed me
how a subselect could achieve this result, but MySQL doesn't support
subselects.
- Sheryl
>- Original Message -
>From: "Sheryl Canter" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Wednesday, February 26, 2003 11:49 A
Sheryl,
See my comments below...
(1) What is the rule that SELECT DISTINCT uses when deciding which of
multiple instances to return? Does it return the first one?
How it selects the distinct items is outside my area of knowledge.
I would not assume it is the first one or the last one, or anywhere
On 27-Feb-2003 Sheryl Canter wrote:
>
> SELECT *
> FROM programs p, authors a, royalties r
> WHERE p.ProgramID = r.ProgramID AND a.AuthorID = r.AuthorID
>
> I could change this to SELECT DISTINCT * ..., but then which author would I
> get? If it's always the first encountered row, then could
: Thursday, February 27, 2003 11:10 AM
Subject: Re: SELECT DISTINCT question
Sheryl,
Sorry I don't time to fully address your question but I will try to give
you some feedback.
The DISTINCT functionality will give you exact that, every distinct
instance of the columns you SELECTED.
SELECT DISTINCT
-
From: "Sheryl Canter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 11:49 AM
Subject: SELECT DISTINCT question
I need help with a query. I have a 'royalties' table that looks like this:
AuthorIDProgramIDRoyalty
-
Didn't receive answer to message below. Could someone please take a look?
TIA.
- Sheryl
- Original Message -
From: "Sheryl Canter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 11:49 AM
Subject: SELECT DISTINCT question
I need help with a query. I have a 'royalties' table that looks like this:
AuthorIDProgramIDRoyalty
--
Author1 Program1 0.15
Author2 Program1 0.10
Author3 Program2 0.25
Author4 Program3 0.05
Author5 Program3
>Say I have a bunch of records in a table with a bunch of fields. One of
>those fields is cluster_id. It is not unique. However, I want to make a
>unique set. I want one record for each cluster_id value. I don't care
>which record that is.
>
>Right now, I do:
>SELECT DISTINCT cluster_id FROM my_ta
> Say I have a bunch of records in a table with a bunch of fields. One of
> those fields is cluster_id. It is not unique. However, I want to make a
> unique set. I want one record for each cluster_id value. I don't care
> which record that is.
>
> Right now, I do:
> SELECT DISTINCT cluster_id FRO
Say I have a bunch of records in a table with a bunch of fields. One of
those fields is cluster_id. It is not unique. However, I want to make a
unique set. I want one record for each cluster_id value. I don't care
which record that is.
Right now, I do:
SELECT DISTINCT cluster_id FROM my_table
Th
25 matches
Mail list logo