all groups > sql server new users > september 2006 >
You're in the

sql server new users

group:

REtrieving Data from More than One Table



REtrieving Data from More than One Table JC HARRIS
9/25/2006 4:25:19 PM
sql server new users: I am new to this so hopefully you'll bare with me if this is a stupid
question.

I receive data in a dbf format from the state office on a yearly basis. I
have figured out how to use SSIS to pull these into the SQL system as
different tables (e. Birth2002, Birth2003, Birth2004) within a single DB.
The state has a habit of changing the fields names from year to year, and
what I would like to do is build standard queries that compares one year to
the next. Since I cannot link this data (it is prenatal birth data) on any
field because there is no like field from one year to the next, what would a
query look like, say, to compare birth_hospital in 2002, 2003, and 2004.

I have three separate Select statements that pulls and groups the data, but
they are feeding into separate panes (one for each year). How do I get them
in one pane side-by-side?

TIA

Re: REtrieving Data from More than One Table Hari Prasad
9/26/2006 12:00:00 AM
Hi,

If you are having the same number of fields you could use UNION.

Select field1,field2 from Birth2002
Union
Select field1,field2 from Birth2003
UNION
Select field1,field2 from Birth2004

If you want side by side, then you could use Temp tables (#)

Thanks
Hari
SQL Server MVP

[quoted text, click to view]

AddThis Social Bookmark Button