LIKE Condition in Access SQL Query?????

  • Thread starter Thread starter Darryn Ross
  • Start date Start date
D

Darryn Ross

Hi,

I am trying to execute a SQL statement from access 2002 and i can't get it
to work properly... is access compatible with the 'LIKE' condition in SQL??
my query executes but returns no records when it should be!!!! ... the SQL
code is below...

SELECT tblChartA.*, tblChartS.Description
FROM tblChartA INNER JOIN tblChartS ON tblChartA.SID = tblChartS.SID
WHERE (((tblChartA.Code) Like "%621%"));

What is wrong with this statement?????


Regards

Darryn
 
Hi,

I am trying to execute a SQL statement from access 2002 and i can't get it
to work properly... is access compatible with the 'LIKE' condition in SQL??
my query executes but returns no records when it should be!!!! ... the SQL
code is below...

SELECT tblChartA.*, tblChartS.Description
FROM tblChartA INNER JOIN tblChartS ON tblChartA.SID = tblChartS.SID
WHERE (((tblChartA.Code) Like "%621%"));

What is wrong with this statement?????

Regards

Darryn

In Access the wildcard is an asterisk.
WHERE (((tblChartA.Code) Like "*621*"));

If you want the user to enter the value, use:
WHERE (((tblChartA.Code) Like "*" & [Enter value] & "*"));
 
Thanks.. that worked great in access, but why won't that SQL statement
return any values when i run it from my C# application??


fredg said:
Hi,

I am trying to execute a SQL statement from access 2002 and i can't get it
to work properly... is access compatible with the 'LIKE' condition in SQL??
my query executes but returns no records when it should be!!!! ... the SQL
code is below...

SELECT tblChartA.*, tblChartS.Description
FROM tblChartA INNER JOIN tblChartS ON tblChartA.SID = tblChartS.SID
WHERE (((tblChartA.Code) Like "%621%"));

What is wrong with this statement?????

Regards

Darryn

In Access the wildcard is an asterisk.
WHERE (((tblChartA.Code) Like "*621*"));

If you want the user to enter the value, use:
WHERE (((tblChartA.Code) Like "*" & [Enter value] & "*"));
 
Back
Top