lucy_maria
New member
- Local time
- Today, 14:27
- Joined
- Jun 29, 2009
- Messages
- 6
Hi. I am not massively technically minded, I try and do as much as I can in queries, but having done some coding and scripting work in the past I can read SQL.
I have three tables:
1. Data is a list of generic country names, each country might appear multiple times.
2. Countries is a list of generic country names and the names used by different suppliers.
3. Prices is a list of the names used by each supplier and the cost to use their services for each country.
The data table changes regularly and I need it to stay generic so that each country is only counted once e.g. 10 Ireland NOT 9 Ireland and 1 Republic of Ireland.
Likewise the suppliers keep changing their names for countries and it is easier to keep everything updated if I can just import the new prices without having to go through searching and replacing for generic country names.
The query setup is that the generic country field in the Data table is counted and is linked to the generic country field in the Countries table. In the countries table one supplier's country field is linked to the country field in the prices table. This query does a few additional calculations and the results are limited by information I've entered onto a form e.g. standard or first class.
What I am trying to get is a list of prices from each supplier in a separate report, only for the countries in the Data table, but I want to do it with the one query and just change the information in the form to create each report.
Everything seems to work except that I need a variable inner join, that links to information in the form. I don't know how to do this in a query. The SQL line looks like this:
FROM (Data_plus_Counts INNER JOIN Countries ON Data_plus_Counts.Country = [Countries].Country) INNER JOIN [Prices] ON [Countries].Crystal = [Prices].Country
I've had a search online but I'm obviously not using the right terms as I'm struggling to come up with anything. I am trying to broaden my knowledge but I'm not having much luck researching this. Does anyone have any ideas?
I have three tables:
1. Data is a list of generic country names, each country might appear multiple times.
2. Countries is a list of generic country names and the names used by different suppliers.
3. Prices is a list of the names used by each supplier and the cost to use their services for each country.
The data table changes regularly and I need it to stay generic so that each country is only counted once e.g. 10 Ireland NOT 9 Ireland and 1 Republic of Ireland.
Likewise the suppliers keep changing their names for countries and it is easier to keep everything updated if I can just import the new prices without having to go through searching and replacing for generic country names.
The query setup is that the generic country field in the Data table is counted and is linked to the generic country field in the Countries table. In the countries table one supplier's country field is linked to the country field in the prices table. This query does a few additional calculations and the results are limited by information I've entered onto a form e.g. standard or first class.
What I am trying to get is a list of prices from each supplier in a separate report, only for the countries in the Data table, but I want to do it with the one query and just change the information in the form to create each report.
Everything seems to work except that I need a variable inner join, that links to information in the form. I don't know how to do this in a query. The SQL line looks like this:
FROM (Data_plus_Counts INNER JOIN Countries ON Data_plus_Counts.Country = [Countries].Country) INNER JOIN [Prices] ON [Countries].Crystal = [Prices].Country
I've had a search online but I'm obviously not using the right terms as I'm struggling to come up with anything. I am trying to broaden my knowledge but I'm not having much luck researching this. Does anyone have any ideas?