Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. select
  2. si.id_sim_info,
  3. si.id_log_info,
  4. ss.id_sim_stat,
  5. ss.name as 'sim_state_name',
  6. si.id_batt_left,
  7. si.id_batt_right,
  8. si.name as 'sim_name',
  9. si.begin_time,
  10. si.end_time,
  11. replace (
  12. concat(
  13.  
  14. '[',
  15. (case when sum(case when sd.current is not null then 1 else 0 end) - count(*) = 0 then '"sim_current",' else '' end),
  16. (case when sum(case when sd.batt_left_volt is not null then 1 else 0 end) - count(*) = 0 then '"sim_batt_left_volt",' else '' end),
  17. (case when sum(case when sd.batt_right_volt is not null then 1 else 0 end) - count(*) = 0 then '"sim_batt_right_volt",' else '' end),
  18. (case when sum(case when sd.batt_left_temp is not null then 1 else 0 end) - count(*) = 0 then '"sim_batt_left_temp",' else '' end),
  19. (case when sum(case when sd.batt_right_temp is not null then 1 else 0 end) - count(*) = 0 then '"sim_batt_right_temp",' else '' end),
  20. (case when sum(case when ld.motor_curr is not null then 1 else 0 end) - count(*) = 0 then '"log_motor_curr",' else '' end),
  21. (case when sum(case when ld.batt_left_volt is not null then 1 else 0 end) - count(*) = 0 then '"log_batt_left_volt",' else '' end),
  22. (case when sum(case when ld.batt_right_volt is not null then 1 else 0 end) - count(*) = 0 then '"log_batt_right_volt",' else '' end),
  23. ']'
  24.  
  25. ),
  26. ',]',
  27. ']'
  28. ) as 'no_empty_data'
  29. from
  30. sim_data sd
  31. join sim_info si
  32. using(id_sim_info)
  33. join sim_stat ss
  34. using(id_sim_stat)
  35. join log_data ld
  36. using(id_log_data)
  37. where
  38. si.id_sim_info > 0
  39. group by
  40. sd.id_sim_info
  41. order by
  42. sd.id_sim_info
  43. desc
  44. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement