|
Subject:
|
what is wrong with this sql..
|
|
Posted By:
|
face
|
Post Date:
|
9/23/2003 2:48:46 PM
|
Sql="SELECT C.zone, C.cost FROM CostByWeightAndZone AS C, ZonesByZip AS Z " _ & "WHERE '770' BETWEEN Z.minzip AND Z.maxzip" _ &"AND C.zone = Z.zone" _ &"AND C.weight = 1;"
im stuck.. it saids missing operator... =(
|
|
Reply By:
|
DaveGerard
|
Reply Date:
|
9/23/2003 3:12:22 PM
|
First of all, what is 770? Also, are Z.minzip and Z.maxzip actual fields in the database or just a range that you are trying to filter for?
|
|
Reply By:
|
face
|
Reply Date:
|
9/23/2003 3:18:08 PM
|
its a range that i want to filter... 770 is just a value i entered to see if my sql would work.. hehe
|
|
Reply By:
|
DaveGerard
|
Reply Date:
|
9/23/2003 3:32:01 PM
|
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.
|
|
Reply By:
|
face
|
Reply Date:
|
9/23/2003 3:36:39 PM
|
Your assumption is correct my man! and it works.. thanks a bunch!!
|
|
Reply By:
|
DaveGerard
|
Reply Date:
|
9/23/2003 3:40:36 PM
|
Well at least I did one thing that was productive today. Not a problem. Have a good one.
|