Guest User

Untitled

a guest
Jul 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. -- today
  2. select sum(traAmount), sum(traCredit) from transactions where traOrdID in (
  3. select OrdID from orders A
  4. left outer join
  5. ( select * from HL7Messages
  6. union all
  7. select * from MC_20091201..HL7Messages
  8. union all
  9. select * from MC_20091101..HL7Messages
  10. union all
  11. select * from MC_20091001..HL7Messages
  12. union all
  13. select * from MC_20090901..HL7Messages ) h on A.ordID = h.HL7OrdID
  14. where h.hl7seq is null
  15. and A.createdby='HL7' and A.ordID>2000000 and created>='20091203'
  16. )
  17.  
  18. -- today list
  19. select HL7Seq, A.ordOrderNo, A.created, A.ordName, * from orders A
  20. left outer join
  21. ( select * from HL7Messages
  22. union all
  23. select * from MC_20091201..HL7Messages
  24. union all
  25. select * from MC_20091101..HL7Messages
  26. union all
  27. select * from MC_20091001..HL7Messages
  28. union all
  29. select * from MC_20090901..HL7Messages ) h on A.ordID = h.HL7OrdID
  30. where h.hl7seq is null
  31. and A.createdby='HL7' and A.ordID>2000000 and created>'20091203' order by A.created desc
Add Comment
Please, Sign In to add comment