April 19, 2005 at 12:02 pm
******************
Dinakar Nethi
Life is short. Enjoy it.
******************
April 19, 2005 at 12:07 pm
Hence my suggestion to read the whole post before trying to help... It's happening far too often these days (not just you ).
April 19, 2005 at 12:12 pm
well to simplfy your suggestions. I have both results stored in physical tables, so I only have table A and Table B with the same schemas. I need to find the 800 rows not in Table A that exist in Table B. There are no constraints on the table but I ran both queries with distinct on the select so I don't beleive duplicates are a problem. I tried something like this,but it didn't work:
SELECT *
FROM [DW_JCFacts].[dbo].[E3JCFact_Detail_NoCT] nct
Where not exists (select *
from [DW_JCFacts].[dbo].[E3JCFact_Detail] ct
where ct.[DivisionFK] = nct.[DivisionFK] and
ct.[CommunityFK]= nct.[CommunityFK] and
ct.[JobFK]= nct.[JobFK] and
ct.[CostCodeFK] = nct.[CostCodeFK] and
ct.[ProjectManagerFK]= nct.[ProjectManagerFK] and
ct.[PostDateFK]= nct.[PostDateFK] and
ct.[CostDateFK]= nct.[CostDateFK] and
ct.[JobCostPeriodFK]= nct.[JobCostPeriodFK] and
ct.[PeriodBudgetFK]= nct.[PeriodBudgetFK] and
ct.[CostType]= nct.[CostType] and
ct.[ReferenceNumber]= nct.[ReferenceNumber] and
ct.[BatchNumber]= nct.[BatchNumber] and
ct.[TransactionDescription]= nct.[TransactionDescription] and
ct.[Cost]= nct.[Cost] and
ct.[Revenue]= nct.[Revenue] and
ct.[Quantity]= nct.[Quantity] and
ct.[OriginalBudget] = nct.[OriginalBudget]and
ct.[RevisedBudget] = nct.[RevisedBudget]and
ct.[OriginalQuantity]= nct.[OriginalQuantity] and
ct.[RevisedQuantity] = nct.[RevisedQuantity])
April 19, 2005 at 12:16 pm
Seems ok from here... what's the problem??
Did you do a select into of the full statements or only the last join that was causing problems?
April 19, 2005 at 12:20 pm
I actually used a DTS package and copied the normal query to the normal table, then removed the Costcode join condition on the source query and changed the destination table to the noCT table.
As a result I have two tables with 8.9m rows, one having 700 extra rows. The above query returned 123809 rows. So weird.
April 19, 2005 at 12:25 pm
Is it possible that you forgot 1 column in the exists?..
or that the diff ljoin screwed up more data than you thaught?
April 19, 2005 at 12:36 pm
no I did a right click drag drop to make sure I got every column and then got the copy/paste skills going on it.
I don't think it's possible the removal of the ljoin screwed up any records.
Well I've determined that the Period budget table being joined too has to be cleaned up before joining to the staged table for the fact build. I don't know exactly what rows are giving me a headache, but I know if CostType does not distinguish how the budgets join to the actualls, it shouldn't be a memeber of the periodbudget Key.
I'll have to resolve this by rebuilding my Periodbudget dimension so that it does not require CostType to distinguish rows by removing duplicate distinct jobcode,costcode, and jobcostperioddate codes found by the following query:
select jobcode,costcode,jobcostperioddate,count(costtype)
from dbo.periodbudgets
group by jobcode, costcode, jobcostperioddate
having count(costtype) > 1
WHen that query contains no results, everything should be fine.
April 19, 2005 at 12:43 pm
Glad you can work it out...
April 19, 2005 at 12:45 pm
thx for your help remi.
Helps to have someone to bounce ideas off of.
April 19, 2005 at 12:56 pm
And from my belly profile you could see that you'd have plenty of room to bounce things off me .
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply