Create a query for comparison

N

Nadeem

Hi,

I have my databse region wise and I have type of cost and cost for eacg region

For example
AFRICA HM 54
EUROPE HM 75
EUROPE HL 100
AMERICA HM 120

How can I create a query where I can select two regions eg, africa & europe
and select cost type HM to compare HM cost between Europe & africa
 
J

John W. Vinson

Hi,

I have my databse region wise and I have type of cost and cost for eacg region

For example
AFRICA HM 54
EUROPE HM 75
EUROPE HL 100
AMERICA HM 120

How can I create a query where I can select two regions eg, africa & europe
and select cost type HM to compare HM cost between Europe & africa

Create a Self Join query by adding this table to the query grid *twice*.
Access will give the second instance of the table an alias by appending _1 to
the name - e.g. MyTable and MyTable_1.

Join the two instances by Region, and include both cost fields.

Put a criterion of "Africa" under one instance of the country name, and
"Europe" under the other; or of course use a parameter query, e.g.

=[Forms]![SomeFormName]![FirstRegion]

under one and

=[Forms]![SomeFormName]![SecondRegion]

under the other, referenceing two combo boxes on a form.
 
K

KARL DEWEY

UNTESTED UNTESTED
Substitute your table and field names --
SELECT [RegionCost].[Type], [RegionCost].[Region], [RegionCost].[Cost],
[RegionCost_1].[Region], [RegionCost_1].[Cost]
FROM [RegionCost] INNER JION [RegionCost_1] ON [RegionCost].[Type]
=[RegionCost_1].[Type]
WHERE [RegionCost].[Type] = [Enter type] AND [RegionCost].[Region] = [Enter
region 1] AND [RegionCost_1].[Region] = [Enter region 2];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top