May 28, 2010 at 4:58 pm
I have two tables, the first, say item_table and second say stage_table. The item_table is a dimensional table with a list of items. The stage_table is a fact table which is populated with inputed data from the transactional stage. I need to query the whole list of items, both the ones which are in stage_table and the ones which are not in stage_table. The ones which are in the stage_table must show me the values, say price, and the ones not present must show me null.
Thanks in advance
Jorge
May 28, 2010 at 5:11 pm
Hi guys, I got the answer in this excellent article
"Intersect, Except, Union, All and Any" (5/21/2010). great resources found here.
May 28, 2010 at 9:44 pm
Actually a FULL OUTER JOIN is probably going to perform better. I believe that article says as much.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
May 29, 2010 at 5:25 am
As the question is written (and as is usual for this sort of requirement) only a LEFT (or RIGHT) OUTER JOIN is required.
SQL Server 2008 also contains some advanced optimisations for queries based on a star (or snowflake) schema.
If you are looking at performing INSERT or UPDATE operations, be sure to look into MERGE.
May 31, 2010 at 6:42 pm
Thanks Paul, as you posted, I finally used right outer join instead of full outer join. Also thanks for the MERGE operator. I´m going to try it. Thanks,
May 31, 2010 at 10:53 pm
Using the Left Outer join
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply