Hey guys,
Take a look at this for me, and tell me if you have any ideas.
I'm on XI 2, on SQL 2000, developing a report querying 7 tables on one datasource. The query approach is a spider one, with one key table left outer joining to the other 5, and one equi-join on primary/foreign keys.
There are some groups based on the key table (which for simplicity's sake, we'll call key_table). The first of these groups is based on customer_number and product_id, which form part of the clustered primary key of this table. This table stores customer and - wait for it - product info for the current business quarter.
These keys are left outer joined to history_table, which stores the same data, but for the last 4 business quarters. It's possible to have some customers or products in history who stopped trading and don't appear in key_table, and new customers who create a vice versa scenario.
Here's where it starts coming off the rails a bit; take the following simple extract;
Because the driving table is key_table, I would expect the groups to be 1234/5/6, (based on a formula of {key.cust}+'-'+{key.prod}). However, what I also get is 1233 as a group also. This occurs if the left outer link is enforced either or both ways.
There's definitely no data for this customer in key_table, and the SQL being generated at run time respects the joins as I would expect. Taking the SQL and running it on the backend for this customer returns 0 rows.
I'm not creating any views from here on in, as I've been tasked with turnaround times of sub-10 seconds per report, and the datamart I've created supports that up to here.
So, anybody have any bright ideas, or come across a workaround for this before?
Cheers,
Naith
Take a look at this for me, and tell me if you have any ideas.
I'm on XI 2, on SQL 2000, developing a report querying 7 tables on one datasource. The query approach is a spider one, with one key table left outer joining to the other 5, and one equi-join on primary/foreign keys.
There are some groups based on the key table (which for simplicity's sake, we'll call key_table). The first of these groups is based on customer_number and product_id, which form part of the clustered primary key of this table. This table stores customer and - wait for it - product info for the current business quarter.
These keys are left outer joined to history_table, which stores the same data, but for the last 4 business quarters. It's possible to have some customers or products in history who stopped trading and don't appear in key_table, and new customers who create a vice versa scenario.
Here's where it starts coming off the rails a bit; take the following simple extract;
Code:
KEY_TABLE
Cust Prod
1234 AAA1
1235 AAA1
1236 AAA2
HISTORY_TABLE
Cust Prod
1233 AAA2
1234 AAA1
1235 AAA1
There's definitely no data for this customer in key_table, and the SQL being generated at run time respects the joins as I would expect. Taking the SQL and running it on the backend for this customer returns 0 rows.
I'm not creating any views from here on in, as I've been tasked with turnaround times of sub-10 seconds per report, and the datamart I've created supports that up to here.
So, anybody have any bright ideas, or come across a workaround for this before?
Cheers,
Naith