mysql的视图能传参数吗

yifuzhiming 2008-06-27 10:49:57
请看以下,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';
...全文
1452 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yifuzhiming 2008-06-27
  • 打赏
  • 举报
回复
我希望把视图当作一样使用,还要跟其他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';
wwwwb 2008-06-27
  • 打赏
  • 举报
回复
在存储过程中解决嘛
懒得去死 2008-06-27
  • 打赏
  • 举报
回复

You can only use prepare statement in store procedure.
yifuzhiming 2008-06-27
  • 打赏
  • 举报
回复
谢谢楼上,我想问下有没有其他办法呢,我这个是要得到结果集给其他sql语句使用啊
wwwwb 2008-06-27
  • 打赏
  • 举报
回复
不能,用存储过程

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧