[GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread Jason Long
I am having some problems moving a column to another table and fixing some views that rely on it. I want to move the area_id column from t_offerprice_pipe to t_offerprice and then left join the results. When I have only one table I get the correct results. area_id is currently in the

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread David Johnston
Jason Long-2 wrote I am having some problems moving a column to another table and fixing some views that rely on it. I want to move the area_id column from t_offerprice_pipe to t_offerprice and then left join the results. When I have only one table I get the correct results. area_id is

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread Jason Long
David, Thank you very much for your response. Below is a script that will reproduce the problem with comments included. /***/ --drop table t_item; --drop table t_price_base_table; --drop table t_price_original_with_area_id; --this table

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread David Johnston
Jason Long-2 wrote David, Thank you very much for your response. Below is a script that will reproduce the problem with comments included. /* This is the new query that is not working correctly. I am trying to left join the base table by its id and area_id. I need a left

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread Jason Long
On Thu, 2013-06-20 at 15:37 -0700, David Johnston wrote: Jason Long-2 wrote David, Thank you very much for your response. Below is a script that will reproduce the problem with comments included. /* This is the new query that is not working correctly. I am trying

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread David Johnston
Jason Long-2 wrote Jason Long-2 wrote There is a unique constraint on the real price table. I hadn't thought of how I will enforce the constraint across two tables. size_id and area_id will have to be unique across both t_price_base_table and t_price_original_with_area_id. I will want

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread Jason Long
On Thu, 2013-06-20 at 16:22 -0700, David Johnston wrote: Jason Long-2 wrote Jason Long-2 wrote There is a unique constraint on the real price table. I hadn't thought of how I will enforce the constraint across two tables. size_id and area_id will have to be unique across both

Re: [GENERAL] Problem with left join when moving a column to another table

2013-06-20 Thread David Johnston
Jason Long-2 wrote Does the syntax you showed me have performance benefits vs joining a bunch of views together? As a general rule CTE/WITH is going to be worse performing than the equivalent view definition - depending on the view is actually used in the query of course. They both have their