Querying a database between two values?

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
 
B

Bob Lehmann

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:
 
G

Guest

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
 
B

Bob Lehmann

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
 
A

Andrew Murray

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.
 
T

Thomas A. Rowe

No.

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top