-3

I have been looking at this for a while and i can't find the syntax error.

IF EXISTS (SELECT * FROM ElpasoTable WHERE elapsoCommand = 'shouldRunWlapon')
BEGIN
END
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Andrew
  • 708
  • 3
  • 7
  • 16

3 Answers3

0

Try this for MySQL

IF EXISTS (SELECT * FROM ElpasoTable WHERE elapsoCommand = 'shouldRunWlapon') THEN
---- YOUR CODE HERE
END IF;
Allen King
  • 2,372
  • 4
  • 34
  • 52
0

Valid commands..

DROP TABLE IF EXISTS...,CREATE TABLE IF NOT EXISTS..

You cannot use IF EXISTS simply in a mysql command.

for your need you can try this instead

perfect solution for your case

usage of IF EXISTS

vijay
  • 493
  • 5
  • 19
0

Actually I don't know what output u want but here is the suggestion. We can't use directly if exists statement. We can use it after certain commands such as delete ,update ,Create etc. First if u want the desired output,remove if exists. So the query will be ( SELECT * FROM ElpasoTable WHERE elapsoCommand = 'shouldRunWlapon') If ur table has column named elapsocommand and value is shouldRunWlapon,,then the Elapsocommand table is displayed.

U can use some concepts between begin and end statements based on ur requirement. They are stored procedures , triggers, views etc

CHAITU
  • 1
  • 2