Details
-
Bug
-
Status: Closed (View Workflow)
-
Trivial
-
Resolution: Incomplete
-
5.5.46, 10.1.10
-
Debian, Ubuntu
Description
I found out, that SELECT Statements always return 0 when the table is empty, and 1 when there's data in the table. Independently of the used query. Let me citate my stack overflow solution.
'Inside of a Stored Procedure Select Exists returns 1 when there is data in the table and null if there is no, when the query is written like that (without specific table set in the where clause): SELECT EXISTS (SELECT * INTO count FROM db.sequencial_host WHERE host_id = host_id_a ORDER BY insert_time DESC LIMIT 1);
If you append the table to the host_id where clause it works as expected. Even counts return the expected value. SELECT EXISTS (SELECT * INTO count FROM db.sequencial_host WHERE sequencial_host.host_id = host_id_a ORDER BY insert_time DESC LIMIT 1);'