Querying a database between two values?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to search a database between two values, but I keep getting a "No records retuned" message when there should be many matching records. The following is the query

fp_sQry="SELECT * FROM STable WHERE (((Price >= ::Price::) AND (Price < ::Price::)));
fp_sDefault="Price=&Price=
fp_sNoRecords="<tr><td colspan=10 align=left width=""100%"">No records returned.</td></tr>
fp_sDataConn="SalesDB
fp_iMaxRecords=25
fp_iCommandType=
fp_iPageSize=
fp_fTableFormat=Tru
fp_fMenuFormat=Fals
fp_sMenuChoice="
fp_sMenuValue="
fp_sColTypes="&ID=3&Address=202&Neighborhood=202&City=202&State=202&Beds=202&Baths=3&Price=3&Description=202&Photo=202&
fp_iDisplayCols=1
fp_fCustomQuery=Tru

What I am I doing wrong? Thanks
 
Substitute numbers for price and you'll see why.

SELECT * FROM STable WHERE (((Price >= ::10::) AND (Price < ::10::)))

You're looking for a value that's

greater than, OR equal to 10

AND

less than 10

Bob Lehmann

MikeG said:
I am trying to search a database between two values, but I keep getting a
"No records retuned" message when there should be many matching records.
The following is the query:
 
Good point. So how do I set up the correct query


----- Bob Lehmann wrote: ----

Substitute numbers for price and you'll see why

SELECT * FROM STable WHERE (((Price >= ::10::) AND (Price < ::10::))

You're looking for a value that'

greater than, OR equal to 1

AN

less than 1

Bob Lehman

MikeG said:
I am trying to search a database between two values, but I keep getting
"No records retuned" message when there should be many matching records
The following is the query
 
I don't use the FP database junk, so I don't know the steps you would take,
but you need 2 variables for price.

SELECT * FROM STable WHERE Price BETWEEN price1 and price2

Bob Lehmann
 
in SQL don't you actually have to have the words "Great than", "Less than" "Equal
to" etc. since SQL is the nearest thing to 'plain english' as far as
programming/query languages go.
 
No.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
Back
Top