查两张表。
select d.id, d.sj, d.sz, s.describe from ycrtdata d, scadatable s where s.describe like '%变压器%有功' and d.sj > '2006-12-14 17:30:00.000'
and d.id = s.id
and d.id = s.id
dateadd函数:加上多少。datepart函数:取那一部分
select DateAdd(minute,-30,GetDate()) AS [100HoursFromNow]
select datepart(hour,getdate())
select datepart(hour,getdate())
显示表的列名。
select name from syscolumns where id in( select id from sysobjects where type='u' and name='check_machine_quantity')