voucher #type
voucher_action #remarks
voucher_campaign_issue #campaign_id
voucher_campaign_issue_request #campaign_id
voucher_request_approve #request_remarks
voucher_receipt_numbers #campaign_id,receipt_no
SELECT * FROM voucher WHERE CONCAT(prefix, voucher_text) IN ('JP500004176','JP500004177') #42176,42177 SELECT * FROM voucher_action WHERE voucher_id IN (42176,42177) AND action_id = 30 SELECT * FROM voucher_campaign_issue WHERE voucher_id IN(42176,42177)
SELECT *
FROM voucher_campaign_issue_request
WHERE request_id IN (11591)
SELECT * FROM voucher_request_approve WHERE request_id IN (11591) SELECT * FROM voucher_receipt_numbers where voucher_ids like 'B176,42177%'
select e.prefix, e.suffix, length(f.voucher_text) AS len, e.start_no, e.end_no, f.voucher_value , e.total_vouchers, e.total_value, d.type_desc, h.user_name, a.request_time, a.`request_remarks`, d.type_name from jurongpoint.voucher_request_approve a, jurongpoint.voucher_campaign_issue_request b, jurongpoint.voucher_campaign c ,jurongpoint.voucher_lkup_type d, jurongpoint.voucher_batch_no_section e, jurongpoint.voucher f, evo_central_config.customer_user h where `request_time` between '2014-08-01 00:00:00' and '2014-12-05 23:59:59' and a.`from_stock` = '35' and a.`to_stock` = '50' and a.request_id = b.request_id and b.campaign_id = c.campaign_id and c.type_id = d.type_id and e.batch_id = a.batch_id and e.prefix = f.prefix and e.suffix = f.suffix and e.start_no = f.voucher_no and a.request_user = h.user_id and d.type_name = 'partner' order by a.request_time desc