sql statement w/ where clause of part of a field.

Discussion in 'Microsoft Access Reports' started by SteveN, Sep 4, 2003.

  1. SteveN

    SteveN Guest

    Could someone tell me how I might be able to construct a
    sql statement with a where clause that matches only part
    of the field?

    For example I'd like to do a select statement with a
    where clause that matches the first three digits of a
    column/field. ie SELECT * FROM ABC WHERE XYZ = 123.

    ABC = table name
    XYZ = column
    123 = the first three digits of XYZ column (note the XYZ
    column could contain 123789 or 123546 and they would be
    selected). Thanks in advance for any suggestions!
     
    SteveN, Sep 4, 2003
    #1
    1. Advertisements

  2. SteveN

    Duane Hookom Guest

    SELECT * FROM ABC WHERE XYZ Like "123*"
    or
    SELECT * FROM ABC WHERE Left(XYZ,3) = "123"

    --
    Duane Hookom
    Microsoft Access MVP


    "SteveN" <> wrote in message
    news:16c601c37297$eb365320$...
    > Could someone tell me how I might be able to construct a
    > sql statement with a where clause that matches only part
    > of the field?
    >
    > For example I'd like to do a select statement with a
    > where clause that matches the first three digits of a
    > column/field. ie SELECT * FROM ABC WHERE XYZ = 123.
    >
    > ABC = table name
    > XYZ = column
    > 123 = the first three digits of XYZ column (note the XYZ
    > column could contain 123789 or 123546 and they would be
    > selected). Thanks in advance for any suggestions!
    >
    >
     
    Duane Hookom, Sep 4, 2003
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    479
    Leasha
    Apr 28, 2004
  2. Ginger

    SQL - Where clause

    Ginger, May 5, 2004, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    131
    Guest
    May 6, 2004
  3. Dean Slindee

    How to add an AND clause to a function statement

    Dean Slindee, Nov 6, 2006, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    144
    fredg
    Nov 6, 2006
  4. Mark G

    Underline part of a contatenated statement

    Mark G, Dec 13, 2007, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    298
    Mark G
    Dec 14, 2007
  5. Marlo Clark

    more than one table listed in from clause of sql

    Marlo Clark, Sep 22, 2008, in forum: Microsoft Access Reports
    Replies:
    3
    Views:
    753
    KARL DEWEY
    Sep 22, 2008
Loading...

Share This Page