Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2003, 02:48 PM
Authorized User
 
Join Date: Sep 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default what is wrong with this sql..

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... =(

 
Old September 23rd, 2003, 03:12 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

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?

 
Old September 23rd, 2003, 03:18 PM
Authorized User
 
Join Date: Sep 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

its a range that i want to filter...
770 is just a value i entered to see if my sql would work.. hehe

 
Old September 23rd, 2003, 03:32 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.

 
Old September 23rd, 2003, 03:36 PM
Authorized User
 
Join Date: Sep 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your assumption is correct my man! and it works.. thanks a bunch!!

 
Old September 23rd, 2003, 03:40 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well at least I did one thing that was productive today. Not a problem. Have a good one.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me!Who can tell me where is wrong? kevinchen2004 C# 2 March 7th, 2005 06:22 AM
Help..What am I doing wrong... Brettvan1 VB.NET 2002/2003 Basics 2 October 18th, 2004 02:36 AM
SQL "Last" instruction returns wrong value rjp Access VBA 0 August 31st, 2004 10:19 PM
What's wrong with this SQL Statement dc925 ADO.NET 4 January 23rd, 2004 11:27 AM
What's wrong with my SQL statement? kaz VS.NET 2002/2003 1 December 11th, 2003 09:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.