Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Posts
    362

    Unanswered: product_title like '%len%' not working (was "Query")

    I have this guery
    Code:
    SELECT price  FROM products where product_title like '%len%' and product_price>0
    where product_title is text and product_price curency.
    This qyery does not work properly, I suppose there is a bug of the format of product_price.
    Can anyone help?
    dimis

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi demis

    Where is the table? Where is the query? Are you running it in the query grid or via code? Have you enabled ANSI SQL?

    If the answers to the last three are "Access", "Query Grid" and "No" then change the % to *

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    to expand on the audacious ones answer....
    Access by default uses its own wild card comaprators *, whereas ANSI SQL uses %

    if you are using a recent version of Access (2000 on) AND ADO you can enable ANSI compatibility as an option. If you intend this app to move to a server data store then consider using %as the deafult option - it willmake your life easier in the long term.

    if you are using an earlier version of DAO then you need to use the Access version *
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Jan 2005
    Posts
    362

    asp

    I have an asp form with some field when I put len at title
    Code:
    SELECT * FROM products 
    where product_title like '%len%'
    the query, returns 7 values but when I put the values at prices
    Code:
    SELECT * 
    FROM products where product_title like '%len%' 
    and product_price>0
     and product_price<11
    No values comes.
    That was the way since I put cint at the code that retrieve the prices
    Now I test it again.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ah - ADO. OK - % is correct as you know.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    What about:
    Code:
    SELECT * 
    FROM products where product_price>0
    Just to be sure. Also - you know select * is bad practice yes? Should really be SELECT ColA, ColB, ColC etc etc.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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