How to get DATA from a mysql query bewtween two dates?
I am Looking for a way to fetch the data between two date, for which I am using below query,
SE开发者_运维问答LECT 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?
Remove this additional AND
from you query
payment_status = '0' AND tbl_doc.company_id='1' AND AND tbl_doc.doctype_id = '1' AND
To
payment_status = '0' AND tbl_doc.company_id='1' AND tbl_doc.doctype_id = '1' AND
精彩评论