Du kan bruge en forespørgsel som sådan:
SELECT subjectcode.Year1, subjectcode.Year2,
subjectcode.Subjectcode, subjectcode.Subjectname,
subjectcode.Theory_Practical, q.fee
FROM subjectcode
INNER JOIN (
SELECT fees.Year1, fees.Year2, "Theory" As FeeType,
fees.Theoryfee As Fee
FROM fees
UNION ALL
SELECT fees.Year1, fees.Year2, "Practical" As FeeType,
fees.Practicalfee As Fee
FROM fees) AS q
ON (subjectcode.Theory_Practical = q.FeeType)
AND (subjectcode.Year2 = q.Year2)
AND (subjectcode.Year1 = q.Year1)
Du ville dog være meget bedre stillet ved at omdesigne din gebyrtabel, så den matcher de data, der returneres af den indre sql, det vil sige en anden linje for teori og praktiske gebyrer:
Year1 Year2 FeeType Fee
2001 2003 Theory 440
2001 2003 Practical 320