l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Jul 21 01:35

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] SQL help - unions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] SQL help - unions

On Tue, 20 Jul 2004, David Hummel wrote:

> On Tue, Jul 20, 2004 at 06:20:06PM -0700, Jeff Newmiller wrote:


> > As the other respondents suggested, different SQL engines have different
> > levels of support for the language.
> > 
> >     SELECT SSN from [Fall 2003] WHERE race == 1
> >     UNION
> >     SELECT SSN from [Spring 2004] WHERE race == 1
> The comparison operator for equal is '=' not '=='.

Yes, I know, but this was in Peter's original, and I thought MySQL
supported this, so I left it alone.

> > gets you a little bit closer, but there are a couple of problems with 
> > this... it isn't really obtaining a headcount,
> Yes it is.  As is Michael Wenk's version.

A headcount is not the same as a roster... neither Peter's nor Michael's
version was counting anything.

In fact, Michael's version is just wrong.  He uses an open join, which is
different than a union join.  The former concatenates the columns to give
two distinct "SSN" columns and selects all possible pairings of the values
in these columns, and the columns must be referred to with table names to
distinguish them.  Since he isn't constraining this open join, he ends up
with all possible pairings of SSN values (if there are 200 in the fall and
300 in the spring, then there are 60000 rows in his result).

> > and unions don't eliminate duplicates.
> Yes they do.

This was from my experience... and since I don't recall the exact
instance and the documentation agrees with you, I won't argue.

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.