订单列表查询1.sql 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. select t1.ftype,
  2. t1.ftypemx,
  3. t1.saorderid,
  4. t1.fsonum,
  5. convert(varchar(10), t1.fdate, 120) fdate,
  6. t1.fcontact,
  7. t1.fprovince,t1.fcity,t1.fcounty,
  8. t1.faddress,
  9. t1.fnotes,
  10. convert(varchar, t1.submitdate, 120) submitdate,
  11. convert(varchar, t1.needdatereplydate, 120) needdatereplydate,
  12. convert(varchar, t1.needdateconfirmdate, 120) needdateconfirmdate,
  13. convert(varchar, t1.checkdate, 120) checkdate,
  14. convert(varchar, t1.closedate, 120) closedate,
  15. t1.fstatus,
  16. t1.fagentnum,
  17. t1.fagentshortname,
  18. t1.fbrand,
  19. t1.fieldname,
  20. t1.fsaler,
  21. t3.displayname fsalername,--ÇøÓò¾­ÀíÃû³Æ
  22. t1.fiswuliao,
  23. t1.fpayagentnum,
  24. t4.fagentname as fpayagentname,
  25. t4.fagentshortname as fpayagentshortname,
  26. t1.frecagentnum,
  27. t5.fagentname as frecagentname,
  28. t5.fagentshortname as frecagentshortname,
  29. t1.fprojectnum,
  30. t6.fprojectname,
  31. t7.fwriteofstatus,
  32. t7.finvoicestatus
  33. from saorder t1
  34. left join pp_hr t3 on t1.fsaler = t3.hrid
  35. left join tagents t4 on t1.fpayagentnum = t4.fagentnum and t1.siteid = t4.siteid
  36. left join tagents t5 on t1.frecagentnum = t5.fagentnum and t1.siteid = t5.siteid
  37. left join tproject t6 on t1.fprojectnum = t6.fprojectnum and t1.siteid = t6.siteid
  38. left join saorder_view1 t7 on t1.saorderid = t7.saorderid
  39. where t1.fstatus!='ɾ³ý'and t1.fagentnum =$fagentnum$ and $where$ and t1.siteid=$siteid$