Advertisement
clickio

ads.txt sql

Dec 16th, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. ##italy
  2. select t.`demand_source_id`, t.`line` from rabota_db.`demand_source_txt` t
  3. join rabota_db.`demand_source` ds on ds.`demand_source_id`=t.`demand_source_id`
  4. where t.`demand_source_id` not in (
  5. select t.demand_source_id FROM rabota_db.`demand_source_requirement` t
  6. WHERE t.`requirement`="commercial_region" AND t.requirement_type="keep_only" AND t.value="cis"
  7. )
  8. and t.`demand_source_id` not in (23,64)
  9. and ds.`disabled`=0
  10. group by 2
  11. ;
  12.  
  13. ##cis
  14. SELECT t.`demand_source_id`, t.`line` FROM rabota_db.`demand_source_txt` t
  15. JOIN rabota_db.`demand_source` ds ON ds.`demand_source_id`=t.`demand_source_id`
  16. WHERE t.`demand_source_id` NOT IN (
  17. SELECT t.demand_source_id FROM rabota_db.`demand_source_requirement` t
  18. WHERE t.`requirement`="commercial_region" AND t.requirement_type="keep_only" AND t.value="italy"
  19. )
  20. AND t.`demand_source_id` NOT IN (23,64)
  21. AND ds.`disabled`=0
  22. GROUP BY 2
  23. ;
  24.  
  25. #not italy, not cis
  26. SELECT t.`demand_source_id`, t.`line` FROM rabota_db.`demand_source_txt` t
  27. JOIN rabota_db.`demand_source` ds ON ds.`demand_source_id`=t.`demand_source_id`
  28. WHERE t.`demand_source_id` NOT IN (
  29. SELECT t.demand_source_id FROM rabota_db.`demand_source_requirement` t
  30. WHERE t.`requirement`="commercial_region" AND t.requirement_type="keep_only" AND t.value="italy"
  31. )
  32. and t.`demand_source_id` NOT IN (
  33. SELECT t.demand_source_id FROM rabota_db.`demand_source_requirement` t
  34. WHERE t.`requirement`="commercial_region" AND t.requirement_type="keep_only" AND t.value="cis"
  35. )
  36. AND t.`demand_source_id` NOT IN (23,64)
  37. AND ds.`disabled`=0
  38. GROUP BY 2
  39. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement