13

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 ?

Community
  • 1
  • 1
GoodSp33d
  • 6,252
  • 4
  • 35
  • 67

1 Answers1

34

use the following syntax to replace the view:

CREATE OR REPLACE VIEW `my_view` AS SELECT ...
MOCKBA
  • 1,680
  • 11
  • 19