请教sqlite数据库问题

DareOnly 2010-11-08 05:13:49
string sqlF = @"
select
max(online_count) y,
trunc((create_time - to_date('{0}','YYYY-MM-DD HH24:MI:SS')) / {1}) relativeValue,
to_date('{0}','YYYY-MM-DD HH24:MI:SS') + (trunc((create_time - to_date('{0}','YYYY-MM-DD HH24:MI:SS')) / {1})) * {1} x
from
online_statistic
where
create_time > to_date('{0}','YYYY-MM-DD HH24:MI:SS') and create_time < to_date('{2}','YYYY-MM-DD HH24:MI:SS')
and (cpid,content_id,content_type) in (({3}))
group by
trunc((create_time - to_date('{0}','YYYY-MM-DD HH24:MI:SS')) / {1})
order by
x asc";

string sql = string.Format(sqlF, start, scaleUnit, end, contentIdentify);
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
iihero_ 2010-11-09
  • 打赏
  • 举报
回复
如果没有对应函数的话,只能自己扩充,或者看看sqlite的官方手册,看看有没有替代品。
ACMAIN_CHM 2010-11-08
  • 打赏
  • 举报
回复
很多函数都没有,包括这个TO_DATE()

你想实现的功能是什么?
DareOnly 2010-11-08
  • 打赏
  • 举报
回复
忘记说问题了, 这个sql语句原先是在oracle中运行,先迁移到sqlite中,sqlite没有trunc函数吧,第一次接触sqlite还请执教

2,209

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 其他数据库
社区管理员
  • 其他数据库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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