Advertisement
Guest User

Untitled

a guest
Nov 13th, 2015
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. SELECT distinct review_type, d_inserted from tmp_adhoc_review order by d_inserted desc
  2.  
  3. SELECT count(*) FROM TMP_ADHOC_REVIEW WHERE REVIEW_TYPE = 'MULTI-RULES' AND d_inserted = '20151105'; --mulit rules=1758
  4.  
  5. --SELECT count(*) FROM TMP_ADHOC_REVIEW WHERE REVIEW_TYPE = 'MULTI-RULES' and d_inserted = '20151102';
  6.  
  7.  
  8. select distinct review_type,d_inserted, count(*) from tmp_adhoc_review group by review_type,d_inserted order by d_inserted desc
  9.  
  10.  
  11. SELECT tmp.id_meter AS meter_code,
  12. tmp.id_workload AS job_id,
  13. CB.ID_BATCH AS feeder_code,
  14. cm.d_gather AS gathered,
  15. MB.METER_COUNT AS mtr_count,
  16. codes (CM.t_phase) AS phase,
  17. codes (cm.o_prepaid) AS Payment,
  18. codes (cm.t_tension) AS Tension,
  19. CB.ID_FEEDER AS Feeder_Name,
  20. CW.ACTIVITY_NAME AS Substation,
  21. sl.location as SUB_LOCATION,
  22. sl.road as SUB_road,
  23. sl.region as sub_region,
  24. codes (cm.t_manufacturer) AS Manufacturer,
  25. cm.id_premise AS MB_Number,
  26. codes (cm.t_usage) AS Usage,
  27. cm.n_lect AS Readings,
  28. cm.no_meter AS meter_number,
  29. tmp.num_apa AS ICS_MTR_NO,
  30. get_last_reading (tmp.nis_rad, tmp.num_apa) AS LastReadings,
  31. codes(tmp.co_marca) AS Manufacturer,
  32. tmp.nis_rad AS SRN,
  33. GET_USAGE_TYPE (tmp.nis_rad, tmp.num_apa) AS Usage,
  34. tmp.f_inst AS Installed,
  35. tmp.f_lvto AS Removed,
  36. icl.nom_local AS locality,
  37. icm.nom_munic AS municipality,
  38. TRIM (
  39. icf.num_puerta
  40. || ' '
  41. || icj.nom_calle
  42. || ' '
  43. || ict.desc_tipo)
  44. AS address,
  45. icf.ref_dir AS plot_reference,
  46. icf.num_itin AS itinerary,
  47. tmp.nif_apa AS prn,
  48. tmp.aol_pm As aol_PM,
  49. DECODE (TMP.IND_SOURCE,
  50. 'A', 'Apmedida',
  51. 'H', 'HApmedida')
  52. AS Source,
  53. cm.gis_x,
  54. cm.gis_y,
  55. tmp.REVIEW_TYPE as Review_type,
  56. tmp.d_inserted date_inserted
  57. FROM TMP_ADHOC_REVIEW tmp,
  58. cam_meters cm,
  59. cam_batches cb,
  60. fincas@ics.world icf,
  61. tipos@ics.world ict,
  62. callejero@ics.world icj,
  63. localidades@ics.world icl,
  64. municipios@ics.world icm,
  65. bdiv10_meterbox mb,
  66. cam_workloads cw
  67. LEFT JOIN
  68. (SELECT j.codigo AS job_id, s.LOCATION, s.road, j.region
  69. FROM bdi_posicional_adminis.bdiv10_historico_trabajos j,
  70. bdi_posicional_adminis.bdiv10_sec_local s
  71. WHERE j.sec_substation_v10 = '3000:' || s.codigo
  72. AND s.onis_ver = 0) sl ON cw.id_workload = sl.job_id
  73. WHERE tmp.id_meter = cm.id_meter
  74. AND tmp.id_workload = cm.id_workload
  75. AND cm.id_workload = CW.ID_WORKLOAD
  76. AND CW.ID_BATCH = CB.ID_BATCH
  77. AND icf.nif = tmp.nif_apa
  78. AND icf.cod_calle = icj.cod_calle
  79. AND icj.cod_local = icl.cod_local
  80. AND icl.cod_munic = icm.cod_munic
  81. AND icj.tip_via = ict.tipo
  82. and cm.id_premise = mb.codigo
  83. --AND tmp.REVIEW_TYPE = 'MULTI-RULES'
  84. AND tmp.d_inserted = '20151113'
  85. order by tmp.id_workload,tmp.nif_apa desc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement