我正在使用 SQL Server 2008 R2 Standard,但我对 SQL Server 还是很陌生。
我试图找出当 ax (测量值)具有超过 48 个日期时间间隔的趋势数据时。
提前致谢。
我的基本查询结构是
SELECT sites.site_name,
measurements.measurement_name,
trend_data_temp.trend_data_avg,
trend_data_temp.trend_data_time
FROM sites
INNER JOIN group_sites
ON sites.site_id = group_sites.site_id
INNER JOIN groups
ON group_sites.group_id = groups.group_id
INNER JOIN measurements
ON sites.site_id = measurements.site_id
INNER JOIN trend_data
ON measurements.measurement_id = trend_data.measurement_id
INNER JOIN trend_data_temp
ON measurements.measurement_id = trend_data_temp.measurement_id
GROUP BY sites.site_name,
measurements.measurement_name,
trend_data_temp.trend_data_avg,
trend_data_temp.trend_data_time
ORDER BY sites.site_name,
measurements.measurement_name