Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop view which does not exist

Tags:

mysql

I am unable to create a view. It throws an error that that table already exists, but if I try to drop it, it says unknown table. I checked out this question but it didnt help much.

drop view if exists foo;
create view foo ... ;
# Table foo already exists
drop table / DROP TABLE IF EXISTS foo;
# unknown table foo

Flush table/repair table didnt solve either. Any ideas ?

like image 471
GoodSp33d Avatar asked Jan 21 '13 14:01

GoodSp33d


1 Answers

use the following syntax to replace the view:

CREATE OR REPLACE VIEW `my_view` AS SELECT ...
like image 77
MOCKBA Avatar answered Nov 09 '22 09:11

MOCKBA