IGNORE THIS SILLY ANSWER AND READ PHILIP COLE'S INSTEAD!
Well, it depends on WHICH database you are using.
With MySQL, you could use a regular expression to easily do this:
Code:
SELECT ... WHERE name REGEXP 'a.*?,' ...
or maybe
SELECT .... WHERE name REGEXP 'a[^,]*,' ...
(says "find an 'a' followed by any number of characters followed by a comma" -- so 'a' has to be in the last name)
In SQL Server, it would be more complex. Something like
Code:
SELECT ...
WHERE CHARINDEX( 'a', name ) > 0
AND CHARINDEX( 'a', name ) < CHARINDEX( ',', name )
...
In Access:
Code:
SELECT ...
WHERE INSTR(name,'a') > 0
AND INSTR(name,'a') < INSTR(name,',')
...
You could, of course, use the CHARINDEX technique with MySQL, too, but the REGEXP would be easier.