Hello:
I just learned how to put crosstabs queries together but this one in particular is adding a new dimension in which I was hoping someone could give me some direction. I have the following tables
The Tables:
[code=text]
Table Name = tblStaticAllFor ecast
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
ProductIDFK; Number; Foreign Key for the Product ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
Fweek; Number; Week number of a month (1-5)
Binding_Percent age; Number; Binding Percentage
[/code]
[code=text]
Table Name = tblPrior
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
ProductIDFK; Number; Foreign Key for the Product ID
ProductName; Text; Product Name
[/code]
[code=text]
Table Name = tblbudget
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
ProductIDFK; Number; Foreign Key for the Product ID
ProductName; Text; Product Name
[/code]
[code=text]
Table Name = tblCreditRegion
Field Type IndexInfo
CreditRegID; AutoNumber; The Credit ID
CreditRegionNam e; Text; Product Name
[/code]
[code=text]
Table Name = tblproduct
Field Type IndexInfo
ProductID; AutoNumber; The Product ID
ProductName; Text; Product Name
ProductType; Text; Product Type
[/code]
I need to run a report where I have to show all of the credit regions [GWP] values but also group them by [ProductType]. I got to the point where I have a query that displays all of the Credit Regions [GWP] values (12 in this case). This is comprised of three other queries (“ctqQueryC_G”, “QryProd_Credit _Bud”, & “QryProd_Credit _Prior”) that I joined together on [CreditRegID] via my “tblCreditRegio n” table:
Query Name = qryGWP_Prod_Cre dit:
[code=sql] SELECT tblCreditRegion .CreditRegionNa me, CLng(Nz([QryProd_Credit_ Bud.SumOfGWP],0)) AS GWP_Bud, CLng(Nz([Week 1],0)) AS Week_1, CLng(Nz([Week 2],0)) AS Week_2, CLng(Nz([Week 3],0)) AS Week_3, CLng(Nz([Week 4],0)) AS Week_4, CLng(Nz([Week 5],0)) AS Week_5, CLng(Nz([QryProd_Credit_ Prior.SumOfGWP],0)) AS GWP_PRI
FROM ((tblCreditRegi on LEFT JOIN ctqQueryC_G ON tblCreditRegion .CreditRegID = ctqQueryC_G.Cre ditRegIDFK) LEFT JOIN QryProd_Credit_ Bud ON tblCreditRegion .CreditRegID = QryProd_Credit_ Bud.CreditRegID FK) LEFT JOIN QryProd_Credit_ Prior ON tblCreditRegion .CreditRegID = QryProd_Credit_ Prior.CreditReg IDFK
GROUP BY tblCreditRegion .CreditRegionNa me, CLng(Nz([QryProd_Credit_ Bud.SumOfGWP],0)), CLng(Nz([Week 1],0)), CLng(Nz([Week 2],0)), CLng(Nz([Week 3],0)), CLng(Nz([Week 4],0)), CLng(Nz([Week 5],0)), CLng(Nz([QryProd_Credit_ Prior.SumOfGWP],0));
[/code]
Now I need to get the [ProductType] in the query so that I can group it by Product Type in my report. I tried to include my product table to the above query but I hit errors. I also tried to add [ProductType] to my individual queries (“ctqQueryC_G”, “QryProd_Credit _Bud”, & “QryProd_Credit _Prior”) and then somehow include it in the above mention final query but got lost.
Can anyone give me a sense of how to go about incorporating this additional grouping/breakout? I mean breakout because that is what I would be doing; breaking out the [GWP] values by Credit Region (Which I already did above) but then by Product Type........
Thanks,
Keith.
I just learned how to put crosstabs queries together but this one in particular is adding a new dimension in which I was hoping someone could give me some direction. I have the following tables
The Tables:
[code=text]
Table Name = tblStaticAllFor ecast
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
ProductIDFK; Number; Foreign Key for the Product ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
Fweek; Number; Week number of a month (1-5)
Binding_Percent age; Number; Binding Percentage
[/code]
[code=text]
Table Name = tblPrior
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
ProductIDFK; Number; Foreign Key for the Product ID
ProductName; Text; Product Name
[/code]
[code=text]
Table Name = tblbudget
CreditRegIDFK; Number; Foreign Key for the Credit Region ID
Field Type IndexInfo
YearID; Number; Year
MonthID; Number; Foreign Key for the Month ID
GWP; Number; Gross Premium
NWP; Number; Gross Premium
ProductIDFK; Number; Foreign Key for the Product ID
ProductName; Text; Product Name
[/code]
[code=text]
Table Name = tblCreditRegion
Field Type IndexInfo
CreditRegID; AutoNumber; The Credit ID
CreditRegionNam e; Text; Product Name
[/code]
[code=text]
Table Name = tblproduct
Field Type IndexInfo
ProductID; AutoNumber; The Product ID
ProductName; Text; Product Name
ProductType; Text; Product Type
[/code]
I need to run a report where I have to show all of the credit regions [GWP] values but also group them by [ProductType]. I got to the point where I have a query that displays all of the Credit Regions [GWP] values (12 in this case). This is comprised of three other queries (“ctqQueryC_G”, “QryProd_Credit _Bud”, & “QryProd_Credit _Prior”) that I joined together on [CreditRegID] via my “tblCreditRegio n” table:
Query Name = qryGWP_Prod_Cre dit:
[code=sql] SELECT tblCreditRegion .CreditRegionNa me, CLng(Nz([QryProd_Credit_ Bud.SumOfGWP],0)) AS GWP_Bud, CLng(Nz([Week 1],0)) AS Week_1, CLng(Nz([Week 2],0)) AS Week_2, CLng(Nz([Week 3],0)) AS Week_3, CLng(Nz([Week 4],0)) AS Week_4, CLng(Nz([Week 5],0)) AS Week_5, CLng(Nz([QryProd_Credit_ Prior.SumOfGWP],0)) AS GWP_PRI
FROM ((tblCreditRegi on LEFT JOIN ctqQueryC_G ON tblCreditRegion .CreditRegID = ctqQueryC_G.Cre ditRegIDFK) LEFT JOIN QryProd_Credit_ Bud ON tblCreditRegion .CreditRegID = QryProd_Credit_ Bud.CreditRegID FK) LEFT JOIN QryProd_Credit_ Prior ON tblCreditRegion .CreditRegID = QryProd_Credit_ Prior.CreditReg IDFK
GROUP BY tblCreditRegion .CreditRegionNa me, CLng(Nz([QryProd_Credit_ Bud.SumOfGWP],0)), CLng(Nz([Week 1],0)), CLng(Nz([Week 2],0)), CLng(Nz([Week 3],0)), CLng(Nz([Week 4],0)), CLng(Nz([Week 5],0)), CLng(Nz([QryProd_Credit_ Prior.SumOfGWP],0));
[/code]
Now I need to get the [ProductType] in the query so that I can group it by Product Type in my report. I tried to include my product table to the above query but I hit errors. I also tried to add [ProductType] to my individual queries (“ctqQueryC_G”, “QryProd_Credit _Bud”, & “QryProd_Credit _Prior”) and then somehow include it in the above mention final query but got lost.
Can anyone give me a sense of how to go about incorporating this additional grouping/breakout? I mean breakout because that is what I would be doing; breaking out the [GWP] values by Credit Region (Which I already did above) but then by Product Type........
Thanks,
Keith.
Comment