MySQL Forums
Forum List  »  Newbie

Re: Union All not working
Posted by: Phillip Ward
Date: November 05, 2024 02:36AM

The SELECT statement reads records. It does not create anything permanent.

select * from tblEVENEMENT 
union all 
select * from _dupEVENEMENT

... reads all the records in tblEVENEMENT, followed by all the records in _dupEVENEMENT and displays them to you. All 672 (= 419 + 253) of them.

If you want to combine these into a new, single table, use the INSERT .. SELECT construct (which is how you created the _dupEVENEMENT table in the first place).

Now you might want to combine these together into a single table, but given that you created one from the other, that would probably give you duplicate keys ... and that would be Bad.

If you had a "main" table that you use the majority of the time and an "archived" table that you used rarely, in conjunction with the "main" table, then it would make sense to keep them separate and only union them together when you actually need both. This can given performance benefits in some cases (usually with very large Data).

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
November 04, 2024 06:07PM
Re: Union All not working
November 05, 2024 02:36AM
November 05, 2024 05:37AM


Sorry, only registered users may post in this forum.

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.