Reputation: 196
I wanted to create a view table in codeigniter and I'm getting the error MySQL Error Number: 1064
$this->db->query('
CREATE VIEW totalamount AS
SELECT column amount, user
FROM transactions
WHERE user = 1
');
Upvotes: 1
Views: 432
Reputation: 2713
Please remember space not support of any database column like you used column name column amount
. Now it will have column_amount
Please follow bellow code :
$this->db->query('CREATE VIEW totalamount AS
SELECT column_amount, user FROM transactions WHERE user = 1');
Upvotes: 1
Reputation: 13226
Might be the column you are using in select is not exist in you table. Please verify it. Because there is space between column 'column amount'.
Upvotes: 0