子串子查询格式

时间:2017-11-10 23:56:48

标签: sql sql-server tsql subquery substring

我很难获得子串qry格式 有些人可以帮我解释子串的编写方式

select tagname, padname = 1, datetime, (select value        
 from analoghistory where tagname = 'tata' +   
 substring(a.tagname, 6, 2) + 'lastpart' and datetime = 
 a.datetime) as value

 from DiscreteHistory a
  where tagname in ('Name here')
  and datetime >= {ts '2017-11-01 07:45:00'}
  and datetime <= {ts '2017-11-10 15:48:00'}
  and wwresolution = 60000
  and value = 1
  order by tagname, datetime

我很感激你的帮助 谢谢

0 个答案:

没有答案