请看以下,A0057是变量,应该传参数进去才行啊CREATE VIEW `tempdata`.`time_view` AS
  SELECT c.code,c.time FROM customercomment c where c.code='A0057'
   union all
  SELECT c.code,c.time FROM customernote c where c.code='A0057';

解决方案 »

  1.   

    谢谢楼上,我想问下有没有其他办法呢,我这个是要得到结果集给其他sql语句使用啊
      

  2.   


    You can only use prepare statement in store procedure.
      

  3.   

    我希望把视图当作一样使用,还要跟其他sql语句做查询撒,实在不行就不用视图了,我想让我的代码好理解一点SELECT c.code,c.time,(SELECT count(*) FROM time_view tv where tv.time<c.time and tv.code=c.code)
    FROM customernote c where c.code='A0057';