|
Cool...thank you. On Thu, 24 Jun 2004 15:02:25 -0400, CWilt@xxxxxxxxxxxx said: > Nope, a union joins two subselect. > > Basically you have two separate select statements that return results. > The > union combines the two result sets into 1 result set. > > select flda, fldb, fldc > from file1 > > union > > select flda, fldb, fldc > from file2 > > > > if file1 has: > f1a1, f1b1, f1c1 > f1a2, f1b2, f1c2 > f1a3, f1b3, f1c3 > > and file2 has > f2a1, f2b1, f2c1 > f2a2, f2b2, f2c2 > f2a3, f2b3, f2c3 > > the results of the UNION is: > f1a1, f1b1, f1c1 > f1a2, f1b2, f1c2 > f1a3, f1b3, f1c3 > f2a1, f2b1, f2c1 > f2a2, f2b2, f2c2 > f2a3, f2b3, f2c3 > > > Note that the two subselects must have the same numbers and types of > columns. Which means you may have to add some dummy fields or change > numeric fields to char. > > HTH, > Charles > > > > -----Original Message----- > > From: michaelr_41@xxxxxxxxxxxxxx [mailto:michaelr_41@xxxxxxxxxxxxxx] > > Sent: Thursday, June 24, 2004 2:36 PM > > To: Midrange Systems Technical Discussion > > Subject: Re: Basic SQL Help > > > > > > Thanks Carel...I'll give it a try...and I'll also study up on > > UNION. Is > > that like a subselect? > > > > On Thu, 24 Jun 2004 20:23:53 +0200, "Carel Teijgeler" > > <coteijgeler@xxxxxxxxx> said: > > > Michael, > > > > > > A rudimentary shot without testing: > > > > > > SELECT 'A' AS Code, a.parent, b.id, c.child, d.id > > > FROM fileA a, fileB b, fileA c, fileB d > > > WHERE (a.parent = b.sku AND b.id = 1 > > > AND c.child = d.sku and d.id = 5 > > > AND a.parent = c.parent) > > > UNION > > > SELECT 'B' AS Code a.parent, b.id, c.child, d.id > > > FROM fileA a, fileB b, fileA c, fileB d > > > WHERE (a.parent = b.sku AND b.id = 1 > > > AND c.child = d.sku and d.id = 9 > > > AND a.parent = c.parent) > > > ORDER BY Code, a.parent > > > > > > To get the description in you have to put in fileC twice, > > each with a > > > different alias. > > > > > > In QMQRY you can create a FORM to omit the column Code and > > break on the > > > column a.parent. > > > > > > Regards, > > > Carel Teijgeler > > > > > > > > > > > > -- > > > This is the Midrange Systems Technical Discussion > > (MIDRANGE-L) mailing > > > list > > > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > > > To subscribe, unsubscribe, or change list options, > > > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > > > or email: MIDRANGE-L-request@xxxxxxxxxxxx > > > Before posting, please take a moment to review the archives > > > at http://archive.midrange.com/midrange-l. > > > > > -- > > > > michaelr_41@xxxxxxxxxxxxxx > > > > -- > > This is the Midrange Systems Technical Discussion > > (MIDRANGE-L) mailing list > > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > > To subscribe, unsubscribe, or change list options, > > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > > or email: MIDRANGE-L-request@xxxxxxxxxxxx > > Before posting, please take a moment to review the archives > > at http://archive.midrange.com/midrange-l. > > > -- > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing > list > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. > -- michaelr_41@xxxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.