如何从两个日期之间的mysql查询中获取数据?
我正在寻找一种方法来获取两个日期之间的数据,为此我使用下面的查询,
SELECT tbl_docuserstatus.*,tbl_doc.doc_assoc_id,tbl_doctype.doctype_id,tbl_doctype.doctype_name,tbl_doc.doc_reference_number,tbl_doc.doc_date,tbl_doc.doc_start,tbl_doc.creator_id,tbl_doc.control_id,tbl_doc.company_id,tbl_doc.vendor_id,tbl_doc.amount,tbl_doc.currency,tbl_doc.paid,tbl_doc.urgent,tbl_dompany.company_name,tbl_dompany.company_code,tbl_vendor.vendor_name
FROM
tbl_docuserstatus
LEFT JOIN
tbl_doc ON tbl_doc.doc_id = tbl_docuserstatus.doc_id
LEFT JOIN
tbl_doctype ON tbl_doctype.doctype_id = tbl_doc.doctype_id
LEFT JOIN
tbl_company ON tbl_company.company_id = tbl_doc.company_id
LEFT JOIN
tbl_vendor ON tbl_vendor.vendor_id = tbl_doc.vendor_id
LEFT JOIN
tbl_users ON tbl_users.user_id = tbl_doc.creator_id
WHERE
payment_status = '0' AND tbl_doc.company_id='1' AND AND tbl_doc.doctype_id = '1' AND tbl_doc.doc_date BETWEEN '2011-04-05 00:00:00' AND '2011-04-07 00:00:00'
上面的查询给了我语法错误,所以有人可以告诉我,
如何从两个日期之间的mysql查询中获取数据?
I am Looking for a way to fetch the data between two date, for which I am using below query,
SELECT tbl_docuserstatus.*,tbl_doc.doc_assoc_id,tbl_doctype.doctype_id,tbl_doctype.doctype_name,tbl_doc.doc_reference_number,tbl_doc.doc_date,tbl_doc.doc_start,tbl_doc.creator_id,tbl_doc.control_id,tbl_doc.company_id,tbl_doc.vendor_id,tbl_doc.amount,tbl_doc.currency,tbl_doc.paid,tbl_doc.urgent,tbl_dompany.company_name,tbl_dompany.company_code,tbl_vendor.vendor_name
FROM
tbl_docuserstatus
LEFT JOIN
tbl_doc ON tbl_doc.doc_id = tbl_docuserstatus.doc_id
LEFT JOIN
tbl_doctype ON tbl_doctype.doctype_id = tbl_doc.doctype_id
LEFT JOIN
tbl_company ON tbl_company.company_id = tbl_doc.company_id
LEFT JOIN
tbl_vendor ON tbl_vendor.vendor_id = tbl_doc.vendor_id
LEFT JOIN
tbl_users ON tbl_users.user_id = tbl_doc.creator_id
WHERE
payment_status = '0' AND tbl_doc.company_id='1' AND AND tbl_doc.doctype_id = '1' AND tbl_doc.doc_date BETWEEN '2011-04-05 00:00:00' AND '2011-04-07 00:00:00'
here the above query given me syntax error, so could some one tell me,
How to get DATA from a mysql query bewtween two dates?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
中删除此附加
AND
从您的查询
Remove this additional
AND
from you queryTo