Reputation: 53
firstname lastname
John doe
Doe Mill
how to select * from table where firstname=lastname
what i want is query displaying 0 result because Doe in firstname have D capital letter
Upvotes: 1
Views: 39
Reputation: 425458
Use LIKE
, which is case insensitive:
select * from table
where firstname like lastname
Upvotes: 0
Reputation: 1011
You can use BINARY
for selecting as is data:
SELECT * FROM table WHERE BINARY firstname = lastname
The BINARY operator casts the string following it to a binary string. This is an easy way to force a comparison to be done byte by byte rather than character by character. BINARY also causes trailing spaces to be significant.
Examples:
See: The BINARY Operator
Upvotes: 1
Reputation: 881
select firstname,lastname from table where upper(firstname) = upper(lastname);
Upvotes: 1