Difference between revisions of "Template:Resultbycountry"
(first draft based on own thinking) |
(emptied the query because it does not work) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <noinclude> | ||
{{#sql-query: | {{#sql-query: | ||
− | SELECT | + | SELECT Cell.Obj_id_v AS Object, Cell_id AS Cell, Cell.Obj_id_r AS Upload, Obj.Ident, Obj.Name, N, GROUP_CONCAT(Loc.Location SEPARATOR ', ') AS Location, Obj.Unit, Mean, SD FROM Obj |
− | + | JOIN (SELECT Obj_id_v, MAX(Obj_id_r) AS Obj_id_r FROM (SELECT * FROM Cell GROUP BY Obj_id_v, Obj_id_r) AS Temp GROUP BY Obj_id_v) AS Newest ON Obj.id=Newest.Obj_id_v | |
− | + | JOIN Cell ON Newest.Obj_id_v=Cell.Obj_id_v | |
− | + | JOIN Loccell ON Cell.id=Loccell.Cell_id | |
− | + | JOIN Loc AS Rawloc ON Loccell.Loc_id=Rawloc.id | |
− | + | JOIN Loc ON Rawloc.Std_id=Loc.id | |
− | AND | + | JOIN Obj AS Ind ON Loc.Obj_id_i=Ind.id |
− | AND | + | WHERE Obj.Ident="Op_en{{PAGEID}}" |
− | AND | + | AND Cell.Obj_id_r={{#if: {{{upload|}}}|{{{upload}}}|Newest.Obj_id_r}} |
− | + | AND Loc.Obj_id_i = 422 | |
+ | AND Loc.Location = "{{{country}}}" | ||
+ | GROUP BY Cell_id | ||
+ | LIMIT 0, 1000 | ||
|·{{{country}}} }} | |·{{{country}}} }} | ||
− | |||
This template is for downloading results from [[Opasnet base]] by country. | This template is for downloading results from [[Opasnet base]] by country. | ||
</noinclude> | </noinclude> |
Latest revision as of 03:20, 6 June 2009
{{#sql-query: SELECT Cell.Obj_id_v AS Object, Cell_id AS Cell, Cell.Obj_id_r AS Upload, Obj.Ident, Obj.Name, N, GROUP_CONCAT(Loc.Location SEPARATOR ', ') AS Location, Obj.Unit, Mean, SD FROM Obj JOIN (SELECT Obj_id_v, MAX(Obj_id_r) AS Obj_id_r FROM (SELECT * FROM Cell GROUP BY Obj_id_v, Obj_id_r) AS Temp GROUP BY Obj_id_v) AS Newest ON Obj.id=Newest.Obj_id_v JOIN Cell ON Newest.Obj_id_v=Cell.Obj_id_v JOIN Loccell ON Cell.id=Loccell.Cell_id JOIN Loc AS Rawloc ON Loccell.Loc_id=Rawloc.id JOIN Loc ON Rawloc.Std_id=Loc.id JOIN Obj AS Ind ON Loc.Obj_id_i=Ind.id WHERE Obj.Ident="Op_en3076" AND Cell.Obj_id_r=Newest.Obj_id_r AND Loc.Obj_id_i = 422 AND Loc.Location = "{{{country}}}" GROUP BY Cell_id LIMIT 0, 1000 |·{{{country}}} }} This template is for downloading results from Opasnet base by country.