比如
macau_data表
id zd
01  2
02  1.8
03  1.5data_dttj表
id zd
01 1.9
02 1.8
03 1.6结果
data_dttj表
id zd
01 2.0
02 1.8
03 1.6就是说要macau_data表的zd字段要大于data_dttj表的zd字段才推荐
就是要这个效果,请问怎样实现?(是access数据库哦,不过也是用sql语句,一样的)

解决方案 »

  1.   

    select id,max(zd) zd from (
    select * from macau_data
    union all
    select * from data_dttj)x group by id
      

  2.   

    又见data_dttj表...
    总想解释为daitaotao
      

  3.   

    是update语句哦,不是select 我是要更新
      

  4.   

    比如
    macau_data表
    id zd
    01  2
    02  1.8
    03  1.5data_dttj表
    id zd
    01 1.9
    02 1.8
    03 1.6更新结果
    data_dttj表
    id zd
    01 2.0
    02 1.8
    03 1.6就是说要macau_data表的zd字段要大于data_dttj表的zd字段才推荐
    就是要这个效果,请问怎样实现?(是access数据库哦,不过也是用sql语句,一样的)
    (update,不是select)
      

  5.   

    select id,max(zd) zd from (
    select * from macau_data
    union all
    select * from data_dttj)x group by id这个是查询阿,update是 update table set..... 这样的阿,都不一样
      

  6.   

    update b set b.zd=a.zd from macau_data a,data_dttj b where a.id=b.id and a.zd>b.zd
      

  7.   

    update b set b.zd=a.zd from macau_data a,data_dttj b where a.id=b.id and a.zd>b.zd
    这样:
    语法错误 (操作符丢失) 在查询表达式 'a.zd from macau_data a' 中。你试试看
      

  8.   

    create table macau_data(id varchar(10),zd dec(10,2))
    insert macau_data select '01',2
    union all select '02',1.8
    union all select '03',1.5create table data_dttj(id varchar(10),zd dec(10,2))
    insert data_dttj select '01',1.9
    union all select '02',1.8
    union all select '03',1.6update b set b.zd=a.zd from macau_data a,data_dttj b where a.id=b.id and a.zd>b.zdselect * from data_dttj
      

  9.   

    那如果你不行,那很可能是access跟sql有些不一样了
      

  10.   

    那你知道如果是access应该是怎样写的呢?
      

  11.   

    --这样update data_dttj b INNER JOIN macau_data a ON b.id = a.id  set b.zd=a.zd where a.zd>b.zd
      

  12.   

    update data_dttj b INNER JOIN macau_data a ON b.id = a.id  set b.zd=a.zd where a.zd>b.zd
    ???