0

So I have a SQL query that returns a name and a id per row. The problem is that the name values, some are upper-cased and others are lower-cased. The query in question is:

SELECT DISTINCT ttd.name, ttd.tid
FROM taxonomy_term_data ttd
INNER JOIN field_data_field_xxxxxx_paraules_clau fdfspc ON ttd.tid = fdfspc.field_xxxxxx_paraules_clau_tid
ORDER BY ttd.name

the result is something like:

alfred | 1
ALBERT | 2
MARIA  | 3
Sam    | 4

What I want is a WHERE clause to only get the rows with upper-cased name like:

WHERE ttd.name IS UPPERCASED

I have been searching on internet, but I only get results about capitalize or uppercased text.

4

1 Answer 1

0

This can be done with the BINARY comparison and UPPER() in mysql

WHERE ttd.name = BINARY UPPER(ttd.name)

source : How to find all upper case strings in a MySQL table?

Sign up to request clarification or add additional context in comments.

1 Comment

It worked! I tried without the binary and nothing. But like this works fine.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.