0
I need to make a select comparing whether user login already exists or not. But I do not want to return values from the table, only a symbolic value to verify the existence (true or false). The comparison code is the basic:
SELECT * FROM USUARIOS WHERE LOGIN = '$LOGIN'
$LOGIN being the login I will compare. And select will return me all table contents unnecessarily.
unnecessary the 'Count' right?
– Douglas Bernardino
No. Quite the contrary, without him the query would have only two results: 1 (if found) or empty (if not found). With the Count you can get 1 (if found) or 0 (if not found).
– electus
as I see it, the good thing about Count is that it will not return an array if it returns more than one value right?
– Douglas Bernardino
In this case you will never return more than 1 result.
– electus
can you tell me if there is a "Uppercase" in the login check = "$login"?? type, select Count(1) from usuarios Where UPPER(LOGIN) = '$LOGIN'...
– Douglas Bernardino
Yes, just use it upper(login) = upper('$LOGIN').
– electus