Translations:ViewPLUS/99/tr

From Mikrodev Documentation
Jump to navigation Jump to search
WITH
t1 AS (
  SELECT  data_value from logs.tag_log  l where tag_id=19 AND data_value IS NOT NULL ORDER BY logtime DESC limit 1 ),
t2 AS (
  SELECT  data_value from logs.tag_log  l where tag_id=20 AND data_value IS NOT NULL ORDER BY logtime DESC limit 1),
t3 AS (
  SELECT  data_value from logs.tag_log  l where tag_id=29 AND data_value IS NOT NULL ORDER BY logtime DESC limit 1),
t4 AS (
  SELECT  data_value from logs.tag_log  l where tag_id=26 AND data_value IS NOT NULL ORDER BY logtime DESC limit 1)
 
SELECT t1.data_value data1, t2.data_value  data2, t3.data_value  data3, t4.data_value  data4
 FROM t1, t2 ,t3,t4;