日期:2014-05-18  浏览次数:20328 次

求一句查询语句?
有二张表h和hh
h表数据如下:
  a
12.03
110.21

hh表数据如下:
    b  
12.01
12.03
112.32

select   h.a   from   h,hh   where   h.a=hh.b
结果
/*
12.03
*/
如果把hh的b字段数据类型改成money那怎么查询?


------解决方案--------------------
不還一樣?
create table h(a float)
insert h
select 12.03 union all
select 110.21

create table hh(b money)
insert hh
select 12.01 union all
select 12.03 union all
select 112.32


select h.a from h,hh where h.a=hh.b

drop table h
drop table hh

a
-----------------------------------------------------
12.029999999999999
------解决方案--------------------
select h.a from h,hh where cast(h.a as money)=hh.b

是这个意思?

------解决方案--------------------
create table #h (
a numeric(10,2)

)

go

create table #hh(
b money,
)
go

insert into #h
select 12.03
union all
select 110.21

go
insert into #hh
select 12.01
union all
select 12.03
union all
select 112.32


select #h.a from #h,#hh where #h.a=#hh.b

drop table #hh
drop table #h
------------------------
我的感觉是一样的呀!没有什么区别呀!
--------------------------------------
要不你用convert()转换一下.