0

I'm Trying to update record on a specific condition.

alasql("UPDATE MyDatabase.FooTBL SET Column2 = 1 Where Column1 = 'foo'")

It Throws error on console

Uncaught TypeError: Cannot read property 'tables' of undefined(…)

Can anyone suggest the solution how i will update the record.

Abdul Jabbar
  • 348
  • 2
  • 10
  • Please provide full code to replicate what SQL you are doing... – mathiasrw Oct 17 '16 at 12:48
  • alasql('CREATE TABLE IF NOT EXISTS MyAtlas.City (city string, population number)'); alasql("INSERT INTO MyAtlas.City Values ('Vienna',894456122)"); @mathiasrw alasql("UPDATE MyAtlas.City SET city = 'ISLO' Where population = 894456122") Insert is working put update is not :( – Abdul Jabbar Oct 18 '16 at 10:57

1 Answers1

1

MyAtlas does not exist - please use:

alasql('CREATE TABLE IF NOT EXISTS City (city string, population number)'); 
> 1

alasql("INSERT INTO City Values ('Vienna',894456122)");
> 1

alasql("UPDATE City SET city = 'ISLO' Where population = 894456122")
> 1

alasql('select * from City')
> [{"city":"ISLO","population":894456122}]
mathiasrw
  • 610
  • 4
  • 10
  • If it is working for insert then how MyAtlas not exist Late reply I switched the framework. alasql to [LoveField](https://github.com/google/lovefield) – Abdul Jabbar Jun 30 '17 at 18:03