Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

check if record exists mysql

-- Returns 1 if exists, 0 else
SELECT EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%');

SELECT 
	CASE 
		WHEN EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%') = 1 THEN
    		'It exists'
    	ELSE 'Does not exist'
	END;
 
PREVIOUS NEXT
Tagged: #check #record #exists #mysql
ADD COMMENT
Topic
Name
8+2 =