oracle 数据库查询 来个人帮帮
是三表联查,现在要做的是加一个判断 当mod(to_number(t.day_date,24)=0)时 DLQXJ.T_PHOTO_DESC f的f.photo_type为1 其他为0;
select (select p.zhs_desc
from UBASE.t_Option p
where p.option_cd = 'WD1000'
and p.option_key = trunc(t.wind_direction))||
(select p.zhs_desc
from UBASE.t_Option p
where p.option_cd = 'WV1001'
and p.option_key = trunc(t.wind_velocity)) as aaa,
f.photo_type,
f.photo_id,
f.PHOTO_NM,
t.CITY_CD,
t.CITY,
t.DAY_DATE,
t.WEATHER,
t.MAX_TEMPERATURE,
t.MIN_TEMPERATURE
from DLQXJ.T_WEATHER_FORECAST t, DLQXJ.T_PHOTO_DESC f
where t.DAY_DATE < 25
and trunc(t.WEATHER) = f.PHOTO_CD
order by t.CITY_CD desc, to_number(DAY_DATE) asc
这是可以运行的,但是那个判断我怎么加都提示出错。
补充下,我是要根据f.photo_type跟f.photo_cd来返回T_PHOTO_DESC中的id用来显示BLOG数据的
------解决方案--------------------
mod(to_number(t.day_date,24)=0)
这是什么东西,你要做什么判断,取余的话也没你这法使的?