First of all you need to join the two tables somehow with a relational field between the two tables. Let say C.Zone = Z.Zone. Then, what is 770? I'm gonna guess and say that it is not a field but the Zip value that has been passed from a form or something. Either way, just a numeric value of some sort. With the assumption that I'm making maybe this will get you close. Your Z.minzip and Z.maxzip fields must be numeric as well as your 770 value for this to work otherwise the code needs to be slightly different.
<%
ZipValue = 770
sql = "SELECT C.zone, C.cost"
sql = sql & " FROM CostByWeightAndZone C"
sql = sql & " INNER JOIN ZonesByZip Z ON C.Zone = Z.Zone"
sql = sql & " WHERE Z.minzip <= " & ZipValue
sql = sql & " AND Z.maxzip >= " & ZipValue
sql = sql & " AND C.weight = 1"
%>
I'm curious so let me know if it helps you.
|