gpt4 book ai didi

mysql - 如何从两个日期之间的mysql查询中获取数据?

转载 作者:行者123 更新时间:2023-11-29 09:10:58 26 4
gpt4 key购买 nike

我正在寻找一种方法来获取两个日期之间的数据,我正在使用下面的查询,

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 查询中获取数据?

最佳答案

从查询中删除此附加 AND

payment_status = '0' AND tbl_doc.company_id='1' AND  AND tbl_doc.doctype_id = '1' AND

payment_status = '0' AND tbl_doc.company_id='1' AND tbl_doc.doctype_id = '1' AND 

关于mysql - 如何从两个日期之间的mysql查询中获取数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5564283/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com