You are here: Re: Return data from multiple tables « MsSQL Server « IT news, forums, messages
Re: Return data from multiple tables

Posted by Erland Sommarskog on 05/22/07 22:04

Rafa³ Bielecki (rafal@bielecki.info) writes:
> I have tables with such structure
>
> transaction_YYMM
> (idx,date,company_id,value)
>
> where YYMM stands for 2digits year and month
> I want to define query (maybe view, procedure):
> select * from [???] where date>='2007-01-01' and date<='2007-04-30'
> which will grab data from
> transaction_0701
> transaction_0702
> transaction_0703
> transaction_0704
> and return all as one

In additions to Dan's response, I like to point out that from a logical
point of view, the above design is flawd. It's a lot easier to deal with a
single table. If there are enourmous volumes, it can still be motivated
with partitioning, but then we are talking enourmous values like tens
of millions of rows per month.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация