doupingpeng7567 2011-02-25 10:04
浏览 29

MySql Query显示带有时间条件的记录

For example i am posting a news via admin and mentioning the start date as 25-02-2011 and end date as 28-02-2011. It will display in the user side on 25the feb 2011.

If i post a news via admin on start date as 26-02-2011 and end date as 28-02-2011 then it will display the news on 26-02-2011.

If i didn't post anything on 27-02-2011 and 28-02-2011 it should display the last posted news. That is in this case it should display the news which is posted on 26-02-2011 for both 27-02-2011 and 28-02-2011.

EDIT: "SELECT id, title FROM news WHERE startDate >= CURDATE() AND
expiryDate <= CURDATE() AND status='Active' ORDER BY id DESC". There is a news in current date. It is not even fetching that record. What change to be done.

How can this be done using mysql.

thanks in advance...

  • 写回答

4条回答 默认 最新

  • dsvd407787736 2011-02-25 10:10
    关注

    If this is a website you are talking about, please mention the server side technology you are using. For example is it using php? Because what you are asking for, can not be accomplished just by using mysql.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向