Advertisement
Pandaaaa906

Untitled

Apr 24th, 2024 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. SELECT
  2. rpt.report_no,
  3. case when prd.material_article_no like '%C3D%' or prd.material_article_no like '%C4X%' then '药物' else '非药' end prd_cls,
  4. prd.material_article_no,
  5. prd.cas_no,
  6. rpt.u8_batch_no,
  7. rpt_test.u8_report_test_plan_code,
  8. t4.title lab_name,
  9. t2.title test,
  10. t3.standard,
  11. rpt_test.remark,
  12. from_unixtime(nullif(rpt_test.plan_time,0)) plan_time,
  13. from_unixtime(nullif(rpt_test.receive_time,0)) receive_time,
  14. from_unixtime(nullif(rpt_test.prepare_time,0)) prepare_time,
  15. from_unixtime(nullif(rpt_test.weight_time,0)) weight_time,
  16. from_unixtime(nullif(rpt_test.data_time,0)) data_time,
  17. from_unixtime(nullif(rpt_test.check_time,0)) check_time,
  18. rpt_test.price,
  19. rpt_test.weight,
  20. result.weight,
  21. rpt_test.id
  22.  
  23. FROM `bv_report_test` rpt_test
  24.  
  25. LEFT JOIN `bv_test` t2
  26. on rpt_test.test_id=t2.id
  27. -- AND t2.`status` = 1
  28.  
  29. LEFT JOIN `bv_test_method` t3
  30. on rpt_test.test_method_id=t3.id
  31.  
  32. LEFT JOIN `bv_company` t4
  33. on t4.code=rpt_test.lab_id
  34. and t4.type = 4
  35.  
  36. INNER JOIN `bv_report_index` rpt
  37. ON rpt_test.report_no=rpt.report_no
  38. AND rpt.status = 1
  39.  
  40. LEFT JOIN `bv_product` prd
  41. on rpt.product_id=prd.id
  42.  
  43. LEFT JOIN bv_report_test_result result
  44. on result.pid = rpt_test.id
  45.  
  46. where 1=1
  47. AND rpt_test.`status` = 1
  48. AND from_unixtime(nullif(rpt_test.prepare_time,0)) BETWEEN '2024-01-01' AND '2024-03-31'
  49. AND t4.title like '%佳途实验室%'
  50. AND t2.title like '%GC%'
  51. -- AND rpt_test.plan_time>= UNIX_TIMESTAMP('2021-01-01')
  52.  
  53. ORDER BY rpt_test.prepare_time desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement