change sql

This commit is contained in:
wlx 2014-12-25 09:15:16 +00:00
parent 3b55dca685
commit 439b62a413
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@
$sql2= "select * from crosstab('SELECT v.fld_time as time,va.fld_name as variablename,v.fld_value as value
FROM tbl_value v left join tbl_variable_info va on v.fld_variable_id=va.fld_variable_id
WHERE v.fld_site_id=$site ORDER BY time',
'select distinct va.fld_name from tbl_variable_info va left join tbl_value v on v.fld_variable_id=va.fld_variable_id
'select distinct va.fld_name from tbl_variable_info va left join tbl_site_sensor_variable v on v.fld_variable_id=va.fld_variable_id
WHERE v.fld_site_id=$site order by va.fld_name')
as ct(time timestamp without time zone";
foreach($rs as $k=>$var)