Advertisement
gsemmobile

Untitled

Jun 13th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.37 KB | None | 0 0
  1. SELECT COUNT(poi.poi_id),
  2.             poi.poi_id,
  3.        poi.name,
  4.          oc_poi_category_id,
  5.          TRIM(nvl(poi.street || ' ' || poi.street_nr || ' ' || poi.post_code || ' ' || poi.location || ' ' || poi.country, ' ')) Address, poi.lm_date "Date",
  6. CASE WHEN (poi.street IS NULL OR poi.street_nr IS NULL OR poi.post_code IS NULL OR poi.location IS NULL OR poi.country IS NULL) THEN 'No'
  7. ELSE 'Yes'
  8. END AS "Has full address"
  9. FROM oc_poi poi,
  10.      wbs wb,
  11.       operation_center op_cen,
  12.       oc_poi_load_data DATA
  13. WHERE poi.poi_id = wb.poi_id
  14. AND wb.operation_center_id = op_cen.operation_center_id
  15. AND wb.ref_number != DATA.ref_number
  16. AND op_cen.name != DATA.operation_center_name
  17. AND wbs_level = 1
  18. AND UPPER(existing_record) LIKE UPPER('N')
  19. AND poi.lm_date >= to_date('01-JAN-12','DD-MON-YY')
  20. AND poi.LM_DATE <= to_date('01-JAN-14','DD-MON-YY')
  21. AND to_char(poi.lm_date,'D') = '1'
  22. AND to_char(poi.lm_date,'HH24:MI') <= '12:00'
  23. --group by poi.poi_id, poi.name, oc_poi_category_id, poi.Address, poi."Date", "Has full address", existing_record;
  24. GROUP BY poi.poi_id,
  25.        poi.name,
  26.          oc_poi_category_id,
  27.          TRIM(nvl(poi.street || ' ' || poi.street_nr || ' ' || poi.post_code || ' ' || poi.location || ' ' || poi.country, ' ')), poi.lm_date, CASE WHEN (poi.street IS NULL OR poi.street_nr IS NULL OR poi.post_code IS NULL OR poi.location IS NULL OR poi.country IS NULL) THEN 'No'
  28. ELSE 'Yes' END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement