SQL语句 不能转存储过程

[复制链接]
查看11 | 回复3 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
SQL语句 不能转存储过程

update adplan
set haveshowtimes=v.count_advlog
from v_my_countadvisitloglist v,adplan a
where v.adid=a.adid
and v.cppgtypeid=a.cppgtypeid
提示错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from v_my_countadvisitloglist v,adplan a
where v.adid=a.adid
and v.cppgtypeid=a.' at line 3
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
“SQL语句 不能转存储过程”这话不太理解,请将你的sql语句和存储过程分别写出并说明你的目的是什么。
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
不好意思 摸索了半天
原因找到
是语法问题 sqlserver 2000大概是sql92语法支持如下
select * from adplaninfo where cpid like '%|'+0+'|%
但是mysql不支持
提错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from adplaninfo where cpid like '%'+@CPID+'%'
end; //' at line 4
mysql 支持模糊查询
select * from adplaninfo where cpid like '%|0|%
但是不支持
select * from adplaninfo where cpid like '%|'+0+'|%

不知道如何进行转换
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
mysql> select * from t1 where b like '%ld%';
+---+------+
| a | b|
+---+------+
| 7 | ldhd |
| 7 | ldhd |
| 7 | ldhd |
| 7 | ldhd |
| 7 | ldhd |
+---+------+
5 rows in set (0.00 sec)
mysql>
直接在要匹配的字符串前后各加一个%就是了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行