Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.59 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SELECT `t`.*, TRUNCATE((COUNT(`t`.`title`) / (SELECT COUNT(*) FROM `tags` AS `t` LEFT JOIN `markers` AS `m` ON t.markers_id = m.id LEFT JOIN `polylines` AS `pl` ON t.polylines_id = pl.id LEFT JOIN `polygones` AS `pg` ON t.polygones_id = pg.id WHERE (m.active = 1) OR (pl.active = 1) OR (pg.active = 1))) * 100, 0) AS `weight` FROM `tags` AS `t` LEFT JOIN `markers` AS `m` ON t.markers_id = m.id LEFT JOIN `polylines` AS `pl` ON t.polylines_id = pl.id LEFT JOIN `polygones` AS `pg` ON t.polygones_id = pg.id WHERE (m.active = 1) OR (pl.active = 1) OR (pg.active = 1) GROUP BY `title` ORDER BY `weight` ASC