存储过程变量

时间:2011-04-07 18:10:53

标签: mysql

我想在存储过程中设置查询,如:

select * from table where xx between '2010' and '2011' 

使用一些变量(时间)而不是静态时间戳。但是,一旦我设置了变量和查询,如

"select * from table where xx between time and time"

"select * from table where xx between 'time' and 'time'", 

它不起作用,你能帮我吗

事先提前

1 个答案:

答案 0 :(得分:1)

如果我们有真正的代码可能会更容易,但是,根据你提供的内容,我会说:

  1. “time”是mysql中的函数名。虽然它没有被列为保留字,但它仍然会让我害怕使用它。
  2. 我不相信“之间”可以用变量参数化。但不是100%。
  3. 我会尝试“my_time> start_time和my_time< end_time”
  4. 希望有所帮助。

相关问题