Query / Count Length Of Field

  • Thread starter Thread starter carl
  • Start date Start date
C

carl

I have data like this...


Symbol Codes
GES ABCIPXZ
TMO BCPX
A ABCIPQWXZ
AA ABCIPQWXZ
AAI ABCIPXZ


The "codes" field can be 1 to 9 characters. Is it possible for a query
to return Symbol when Codes contains a "B" and the length of the field
is 4 characters or less ?

Thank you in advance.
 
carl said:
I have data like this...


Symbol Codes
GES ABCIPXZ
TMO BCPX
A ABCIPQWXZ
AA ABCIPQWXZ
AAI ABCIPXZ


The "codes" field can be 1 to 9 characters. Is it possible for a query
to return Symbol when Codes contains a "B" and the length of the field
is 4 characters or less ?

Thank you in advance.

You didn't tell us what you wanted it to return if the conditions weren't
met ...

SELECT
iif([Codes] LIKE '*B*' AND len([Codes]) <= 4, [Symbol],<fill in the default
value you want>) AS YourFieldName
FROM Tablename

Or maybe you only want it to return rows where those conditions are met ...
?

SELECT [Symbol] AS YourDesiredFieldName
FROM Tablename
WHERE [Codes] LIKE '*B*' AND len([Codes]) < 4
 
Back
Top