Difference between revisions of "Template:Resultbycountry"
m |
(emptied the query because it does not work) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <noinclude> | ||
{{#sql-query: | {{#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 | 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 Cell ON Obj.id=Cell.Obj_id_v | + | 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 Loccell ON Cell.id=Loccell.Cell_id | ||
JOIN Loc AS Rawloc ON Loccell.Loc_id=Rawloc.id | JOIN Loc AS Rawloc ON Loccell.Loc_id=Rawloc.id | ||
Line 7: | Line 9: | ||
JOIN Obj AS Ind ON Loc.Obj_id_i=Ind.id | JOIN Obj AS Ind ON Loc.Obj_id_i=Ind.id | ||
WHERE Obj.Ident="Op_en{{PAGEID}}" | WHERE Obj.Ident="Op_en{{PAGEID}}" | ||
− | AND Cell.Obj_id_r={{#if: {{{upload|}}}|{{{upload}}}| | + | AND Cell.Obj_id_r={{#if: {{{upload|}}}|{{{upload}}}|Newest.Obj_id_r}} |
AND Loc.Obj_id_i = 422 | AND Loc.Obj_id_i = 422 | ||
AND Loc.Location = "{{{country}}}" | AND Loc.Location = "{{{country}}}" | ||
GROUP BY Cell_id | GROUP BY Cell_id | ||
LIMIT 0, 1000 | 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.