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

    Error in WHERE Clause

    Dee, Jul 23, 2003, in forum: Microsoft Access Reports
    Replies:
    0
    Views:
    525
  2. Duane Hookom

    Re: Multi-level GROUP BY clause not allowed in subquery

    Duane Hookom, Aug 2, 2003, in forum: Microsoft Access Reports
    Replies:
    1
    Views:
    679
    ksteger
    Aug 19, 2003
  3. Guest
    Replies:
    1
    Views:
    558
    Leasha
    Apr 28, 2004
  4. Ginger

    SQL - Where clause

    Ginger, May 5, 2004, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    162
    Guest
    May 6, 2004
  5. Ana_T

    IIf statement within a IIf statement

    Ana_T, Jun 16, 2006, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    651
    OfficeDev18 via AccessMonster.com
    Jun 16, 2006
  6. 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:
    182
    fredg
    Nov 6, 2006
  7. Mark G

    Underline part of a contatenated statement

    Mark G, Dec 13, 2007, in forum: Microsoft Access Reports
    Replies:
    2
    Views:
    421
    Mark G
    Dec 14, 2007
  8. 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:
    858
    KARL DEWEY
    Sep 22, 2008
Loading...