need help with sql statement please ...

Results 1 to 2 of 2

Thread: need help with sql statement please ...

  1. #1
    jon Guest

    Default need help with sql statement please ...

    ok, i have a sql statement that im not sure will work, and cannot test out at the moment... could someone please verify if this would work? <BR><BR>ok, i have sandiego as the table right now... and sdcity is the variable with a value from a form from last page... i want sql to pick the cities matching the one chosen on the form, and the price is a bit trickier... on the form, there is a menu to choose a base price such as $100,000 .... ok so then 100000 is the value of sdprice variable.. now i want it so sql selects all the records from sdprice to sdprice + 99000<BR>(so it always is say 100,000 - 199,99, or 200,000 - 299,999.... so basically alwaays adding 99,999 onto the base variable... will this give me the results i am looking for??? thank you so much..!<BR><BR>SQL = "SELECT * FROM sandiego WHERE city = &#039;sdcity&#039; AND price &#062;= &#039;sdprice&#039; AND &#060; &#039;sdprice + 99999&#039; "<BR><BR><BR>or is there a better way to do this?<BR>thanks :)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: need help with sql statement please ...

    yaa u&#039;re way is good.. but it&#039;s not better to put expressions in the sql statement.. too complicated.. one.. my dear<BR>first store that expressions in some variables like<BR>x=request("sdprice")<BR>y=x+99999<BR>and x in ur sql statement...<BR>when u&#039;re checking the expression with AND operator.. u&#039;ve to use... price field name in both sides like<BR>price&#062;=x AND prince&#060;y<BR><BR>that&#039;s all..<BR>all the best<BR>Gopi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts