Results 1 to 3 of 3

Thread: SQL Select Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006

    SQL Select Problem


    Sorry if this is a tad trivial however my knowledge of sql is fairly basic. The problem is with the following select statement, i'm not quite sure how to search for the string "212". I know that it is just a matter of having the quotations in the right place, but i cannot seem to work this out.

    I am using with an access database

            SQLStr = "SELECT Hardware_Problems.Hardware_Problem_Id, Hardware.Hardware_Type, Hardware.Hardware_Make, Hardware.Hardware_Model, Hardware_Problems.Date_Time, Hardware_Problems.Staff_Reported, Hardware_Problems.Problem_Description, Hardware_Problems.Location, Hardware_Problems.Resolve_Flag FROM Hardware INNER JOIN Hardware_Problems ON Hardware.Hardware_Id = Hardware_Problems.Hardware_Id WHERE (((Hardware_Problems.Location)= "212"));"
    Thanks in advanced


  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Bristol, UK

    Re: SQL Select Problem

    Is the field "Location" numeric? If so, dont use quotes around the value.

    If it is a text/char field, use single quotes instead of doubles, eg: = '212'

    (oh, and you don't need those brackets in the Where clause)

  3. #3
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005

    Re: SQL Select Problem

    Are you trying to find just 212? or any string that contains 212?

    if the latter, use the LIKE function instead of =.

Posting Permissions

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

Click Here to Expand Forum to Full Width