Ollie,
Ahh, all this talk of "old-timers" writing merges to cut their teeth in the
'new' field of data processing... it brings on a wave of tender memories -
however looking back, I find that even nostalgia ain't what it used to be!

The earlier response works (assuming key behavior), and is a good idea if
you have a lot of work to do on the combined tables - consider using temp
table so that it automagically disappears when you've finished!

However if you only have a few queries to perform then you may prefer
something more 'dynamic'. From your description I'll assume that the current
invoice file and invoice history file are reasonably similar if not
identical in schema. Check out manual: 6.4.1.2 UNION. "UNION is used to
combine the result from many SELECT statements into one result set."
NB the manual currently says "UNION is implemented in MySQL 4.0.0" but from
memory it was introduced way back (DuBois says "3.24") so I'm unclear as to
what's new and what's not of the syntax.

Regards,
=dn


> create table abc as (select * from xyz1);
> insert into abc values (select * from xyz2);
>
> The above 2 commands should do it.
> You might need to change them a bit, if so
> www.mysql.com/doc should be very helpful.
>
> Regards,
> Bhavin.
> ----- Original Message -----
> From: "Ollie Acheson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 18, 2002 6:24 PM
> Subject: Merge records from multiple tables???
>
>
> > Hi,
> >
> > I am a newcomer to mysql (and pretty much to sql in general). I have a
> > question that is probably pretty simple to answer, but it is escaping
> > me at present.
> >
> > I want to select records from two separate tables and put the results
> > into a result table. Seems pretty simple, but I don't want to join the
> > records from the two tables into combined records in the result table
> > but rather keep them as separate records in the result table.
> >
> > Perhaps an example would clarify what I want to do.
> >
> > Suppose I have two tables of data, such as a current invoice file and
> > an invoice history file. Suppose I need to do a report that would
> > include all records from both files. For the life of me, I don't see
> > how to accomplish this. For the old-timers out there, this was called
> > a merge in an earlier era of data processing.
> >
> > Thanks for any pointers.
> >
> > Ollie
> >
> > --
> > |---------------------------|
> > | Ollie Acheson             |
> > | Morristown, NJ            |
> > |---------------------------|
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


---------------------------------------------------------------------
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

Reply via email to