select g.id, ifnull(s.count, 0)
from t_goods g
left join v_stock s on g.id = s.id
This sql works well, and then I create a view:
create or drop view v_goods_stock as
select g.id, ifnull(s.count, 0)
from t_goods g
left join v_stock s on g.id = s.id
I get the error:
[Err] 1064 - You have an error in your SQL syntax
My mysql version is 5.5.
I try to remove the ifnull function like this
create or drop view v_goods_stock as select g.id id, s.count c from t_goods g left join v_stock s on g.id = s.id
I still get the same error.