Created
April 5, 2018 08:45
-
-
Save worstn8mare/cca91f80ad680b485fd14536e49f6507 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO postings (id,cb,partner_id,post_date,posting_type,status,doc_type,doc_no,attachment_no) | |
| ( | |
| SELECT | |
| a.posting_id as id, | |
| a.cb as cb, | |
| a.partner_id as partner_id, | |
| c.date as date, | |
| "Purchases" as posting_type, | |
| "Posted" as status, | |
| "RR" as doc_type, | |
| a.doc_no as doc_no, | |
| c.id as attachment_no | |
| from gl_entries as a | |
| LEFT JOIN receive_headers as b on b.id = a.doc_no | |
| LEFT JOIN receive_post_details as c on c.rr_id = b.id | |
| where a.doc_type = "RR" and a.doc_no = 20283 and b.status in ("Approved","Printed") | |
| limit 1 | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment