mysql查询所有的数据库中所有的表a,bc,d,e,f等很多表且表的格式是一样的,怎么用找出在某一时间d-c的值是大于一千的表的名字和data的值  ,还有怎么查询相同时间间隔内连续5次这种情况呢 比如表a中存在 09:38:00 323 2342 表a符合条件输出表a和例如这是表a date表示时间 c ,d下面都是数值
date a b   
 09:35:00 245 524
 
09:36:00 234 42409:37:00 423 677
09:38:00 323 2342.......10:35:00 313 323
   10:36:00 323 452
10:37:00 432 34210:38:00 532 344

解决方案 »

  1.   

    select * from (
    select 'a' as ttname,* from a
    union all
    select 'b',* from b
    union all
    select 'c',* from c) a
    where d-c>1000
      

  2.   

    例如这是表a date表示时间 c ,d下面都是数值
    date       c   d   
     09:35:00 245 524
     
    09:36:00 234 42409:37:00 423 677
    09:38:00 323 2342.......10:35:00 313 323
        10:36:00 323 452
    10:37:00 432 34210:38:00 532 344
      

  3.   

    select date,c,d,d-c from a 
    union all
    select date,c,d,d-c from b
    union all
    select date,c,d,d-c from c