所以,我在这里有这个查询:
$strSQL = "SELECT formas.*, SMS_SERVISI.IDTICKET, SMS_SERVISI.MBYLLUR,SMS_SERVISI.time_added,servis_furnitor.id_servis,servis_furnitor.furnitori,servis_furnitor.kohezgjatja
FROM formas
LEFT JOIN servis_furnitor ON formas.furnitori = servis_furnitor.id_servis
LEFT JOIN SMS_SERVISI ON formas.ID = SMS_SERVISI.IDTICKET
ORDER BY formas.id DESC
WHERE $today-formas.data_fillim > servis_furnitor.kohezgjatja";
我知道最后一行是错误的,我的意思是我到那里还好.. 我有这个订单,他们有一个开始日期, formas.data_fillim
我有今天的日期:
$today = date("Ymd");
所以两者之间的差异 $today-formas.data_fillim
不应该大于servis_furnitor.kohezgjatja
整数本身,它显示天数
formas.data_fillim
是一个日期类型..
我需要提取与今天日期和开始日期的差异不大于“kohezgjatja”中预定义的天数的所有数据
请任何帮助..谢谢
更新
$today = date("Y-m-d H:i:s", time());
echo $strSQL = "SELECT formas.*,
SMS_SERVISI.IDTICKET,
SMS_SERVISI.MBYLLUR,
SMS_SERVISI.time_added,
servis_furnitor.id_servis,
servis_furnitor.furnitori,
servis_furnitor.kohezgjatja
FROM formas
LEFT JOIN servis_furnitor
ON formas.furnitori = servis_furnitor.id_servis
LEFT JOIN SMS_SERVISI
ON formas.ID = SMS_SERVISI.IDTICKET
WHERE DATEDIFF ( day , '$today' , formas.data_fillim ) > servis_furnitor.kohezgjatja
ORDER BY formas.id DESC"