Hi all
I need help with a query involving 4 tables. The sql needs to be able to be executed from an asp page. I have the following tables :
tblPollutant
pol_code pol_desc
-------- --------
1 co2
2 sulphur
tblPolLevels
lev_code lev_desc
-------- --------
1 Low
2 Med
3 High
tblOverallPolRating
lev_code (fk tblPolLevels) pol_code(fk tblPollutant) val
------------------------- ------------------------- ----
1 1 10
2 1 15
3 1 20
1 2 15
2 2 20
3 2 25
tblPOL_POLL_AMT
pol_code pol_value
-------- ----------
1 11
2 16
I need to be able to execute a query to get the following data for each record held in the tblPol_POLL_AMT table
pol_value, pol_desc (from tblPollutant), lev_desc (from tblPolLevels)
The pol_value in tblPOL_POLL_AMT needs to be checked against the val field in tblOverallPolRating and assigned the lev_code held in tblPolLevels if it is equal to or lower val and not higher.
Hope this explained well enough it is quite difficult to explain.
Many Thanks for reading
Colin
I need help with a query involving 4 tables. The sql needs to be able to be executed from an asp page. I have the following tables :
tblPollutant
pol_code pol_desc
-------- --------
1 co2
2 sulphur
tblPolLevels
lev_code lev_desc
-------- --------
1 Low
2 Med
3 High
tblOverallPolRating
lev_code (fk tblPolLevels) pol_code(fk tblPollutant) val
------------------------- ------------------------- ----
1 1 10
2 1 15
3 1 20
1 2 15
2 2 20
3 2 25
tblPOL_POLL_AMT
pol_code pol_value
-------- ----------
1 11
2 16
I need to be able to execute a query to get the following data for each record held in the tblPol_POLL_AMT table
pol_value, pol_desc (from tblPollutant), lev_desc (from tblPolLevels)
The pol_value in tblPOL_POLL_AMT needs to be checked against the val field in tblOverallPolRating and assigned the lev_code held in tblPolLevels if it is equal to or lower val and not higher.
Hope this explained well enough it is quite difficult to explain.
Many Thanks for reading
Colin