Friday, February 17, 2012

Data from two databases

Hello.

I have situation here, whitch comfises me a bit. I have to IDENTICAL databases. Diference between then is that they where "filled in" at different times, one till 1st of January 2000, the other after 1st January 2000. Is it possibe to get data out of two databases into one query (resultset) covering periods, included in both databases (let's say from 1st January 1999 till 1st January 2003)

Thanks in advanceSELECT * FROM Server.DatabaseBefore.Owner.TableName
UNION
SELECT * FROM Server.DatabaseAfter.Owner.TableName|||Make sure to use a UNION ALL in this instance, not just a UNION. If you just say UNION then SQL will implicitly do a DISTINCT, which will take longer to process and is not at all necessary in this case.

Terri

No comments:

Post a Comment