[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

Select only values that do not start with a uppercase character

Hi Expert,

I'd like to extract all values from a field that do not start with a uppercase character.

But extracting all values without uppercase characters would work as well.

Kind regards,
0
Steynsk
Asked:
Steynsk
  • 2
  • 2
1 Solution
 
Swapnil NirmalCommented:
Use Binary:

SELECT *
FROM Table1
WHERE BINARY UPPER(Left('Field1',1) = Left('Field1',1)


Just for reference:
http://dev.mysql.com/doc/refman/5.0/en/charset-binary-op.html
0
 
SteynskAuthor Commented:
Hi n_swapnil,

Thanks for the quick responce. but the statement selects all records:

SELECT * FROM people WHERE BINARY UPPER(Left('givenname',1) = Left('givenname',1))

And instead of that it should only show the people with a givenname without uppercase characters.

thanks
0
 
Swapnil NirmalCommented:
Try this:

SELECT * FROM people WHERE BINARY LOWER(Left('givenname',1) = Left('givenname',1))
0
 
hieloCommented:
NOTE: you need to enclose the field/column name in backticks (`) NOT in apostrophes(').

Try:
SELECT * FROM people where ((BINARY `givenname`) REGEXP '^[a-z]')
OR
SELECT * FROM people WHERE BINARY LOWER( Left(`givenname`,1) ) = Left(`givenname`,1)
0
 
SteynskAuthor Commented:
SELECT * FROM people where ((BINARY `givenname`) REGEXP '^[a-z]')

did the job.

Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now