获取datetime的行,这是最新的日期时间小于mysql中的选定日期

I have to get the row with the latest date less than a given date selected from a select box.

I have figured out how to get the row with the latest date like

select * from test_table where created in (select max(created) from test_table)

I know I have to use a created between but I have not been able to solve it. The date which is the upper limit is selected from a select box. SO, I dont know it before hand. Please help me

for example, let the date selected from textbox is Nov 11 2013. I have to get a row with a created date which is the max date in the table less than Nov 11 2013. Thanks in advance

我必须得到最新日期小于从选择框中选择的给定日期的行。 p >

我已经找到了如何获取最新日期的行,如 p>

select * from test_table where in created in(select max(created)from test_table) code> p>

我知道我必须使用 code>之间创建的,但我无法解决它。 从选择框中选择作为上限的日期。 所以,我手头之前不知道。 请帮助我 p>

例如,让从文本框中选择的日期是2013年11月11日。我必须得到一个创建日期的行,即 表格中的最大日期少于2013年11月11日。 谢谢提前 p> div>



 3 条回答