Re: PHP/MySQL - Splitting similar data to two tables and querying as a whole
- From: "ZeldorBlat" <zeldorblat@xxxxxxxxx>
- Date: 17 May 2005 09:59:33 -0700
l...@xxxxxxxxxxxxxxxxx wrote:
> Ok I am working on building my skills to convert my apps to LAMP
(read
> I'm a semi noob), and there was one part I was thinking of. If I
> create two identical MySQL tables (we'll say, invoice and invoicearc)
> one will hold current period data and the other will hod out of
period
> data - previous years stuff, which is only used in queries <5% of the
> time at most.
>
> Now can I join these two tables to make one table when doing queries
> that span the current and prior periods. I've read of joins where
you
> are linking references, like primary and external keys, but not one
> where you are bringing tables of the same structure into a larger
> query. I've googled around a bit but cant find the right syntax to
> find a yea or nay on if it is possible.
>
> I know I could have mmassive tables and put all of this stuff in
there,
> but I was thinking I coud improve speed if I were able to just bring
in
> the archive data only when needed.
select colA, colB, colC
from tbl1
union
select colA, colB, colC
from tbl2
Provided that the columns in both tables have the same data types.
.
- References:
- Prev by Date: Re: PHP/MySQL - Splitting similar data to two tables and querying as a whole
- Next by Date: Re: MySQL PHP =@ symbol
- Previous by thread: Re: PHP/MySQL - Splitting similar data to two tables and querying as a whole
- Next by thread: Re: PHP/MySQL - Splitting similar data to two tables and querying as a whole
- Index(es):
Relevant Pages
|