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

  • Thread starter Thread starter SteveN
  • Start date Start date
S

SteveN

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!
 
SELECT * FROM ABC WHERE XYZ Like "123*"
or
SELECT * FROM ABC WHERE Left(XYZ,3) = "123"
 
Back
Top