-5

I'm using MySQL and I'm trying to return values of CustomerLastName that starts with M, and I know there are some in the database, but they are not being returned. I see CustomerLastName and CustomerFirstName but no names.

SELECT 'CustomerFirstName', 'CustomerLastName'

FROM customer

WHERE LEFT(CustomerLastName, 1 = 'M ');
Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

1

Remove the Single Quotes from select statement

SELECT CustomerFirstName, CustomerLastName

FROM customer

WHERE LEFT(CustomerLastName, 1 = 'M ');
Aditya Rewari
  • 2,343
  • 2
  • 23
  • 36
0

As well as the incorrect quotes in the select WHERE LEFT(CustomerLastName, 1 = 'M '); is not syntactically correct - and you should be seeing a raft of warnings.

Change to

WHERE LEFT(CustomerLastName, 1) = 'M';

And review When to use single quotes, double quotes, and backticks in MySQL

P.Salmon
  • 17,104
  • 2
  • 12
  • 19