Difference between revisions of "Template:Resultbycountry"

From Testiwiki
Jump to: navigation, search
m
(emptied the query because it does not work)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
<noinclude>
 
{{#sql-query:
 
{{#sql-query:
SELECT Loc.*, Rawloc.*, Cell.*, Obj.*, Loccell.*, Res.*
+
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
FROM Loc, Loc AS Rawloc, Cell, Obj, Loccell, Res
+
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
WHERE Loc.Obj_id_i = 422
+
JOIN Cell ON Newest.Obj_id_v=Cell.Obj_id_v
AND Loc.Location = '{{{country}}}'
+
JOIN Loccell ON Cell.id=Loccell.Cell_id
AND Loc.id = Rawloc.Std_id
+
JOIN Loc AS Rawloc ON Loccell.Loc_id=Rawloc.id
AND Obj.Ident = 'Op_en{{{PAGEID}}}'
+
JOIN Loc ON Rawloc.Std_id=Loc.id
AND Obj.id = Cell.Obj_id_v
+
JOIN Obj AS Ind ON Loc.Obj_id_i=Ind.id
AND Cell.id = Loccell.Cell_id
+
WHERE Obj.Ident="Op_en{{PAGEID}}"
AND Loccell.Loc_id = Rawloc.id
+
AND Cell.Obj_id_r={{#if: {{{upload|}}}|{{{upload}}}|Newest.Obj_id_r}}
AND Cell.id = Res.Cell_id
+
AND Loc.Obj_id_i = 422
|·{{{country}}} }}<noinclude>
+
AND Loc.Location = "{{{country}}}"
 +
GROUP BY Cell_id
 +
LIMIT 0, 1000
 +
|·{{{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.