select t.id,
t.name,
a.companyname,
a.longitude,
a.latitude,
a.endtime,
a.userid
from user_base t, action_base a
where t.id = a.userid
and t.name = '李刚'
and a.endtime >= to_date('2012-11-24', 'yyyy-mm-dd')
and a.endtime <= to_date('2012-11-24', 'yyyy-mm-dd')
order by a.endtime
------最佳解决方案-------------------- and a.endtime >= to_date('2012-11-24', 'yyyy-mm-dd')
and a.endtime <= to_date('2012-11-24', 'yyyy-mm-dd')
正确,后面加1就可以了 ------其他解决方案-------------------- 求指点 ------其他解决方案-------------------- 看看2012-11-24这天有“李刚”的数据么,你这查的是这一天的数据吧。 ------其他解决方案-------------------- a.endtime 如果是日期类型用 a.endtime BETWEEN starttime AND endtime ------其他解决方案-------------------- select t.id,
t.name,
a.companyname,
a.longitude,
a.latitude,
a.endtime,
a.userid
from user_base t left join action_base a on t.id = a.userid where
t.name = '李刚' and convert(varchar(10),cast(to_date as datetime),102) between convert(varchar(10),cast(第a.endtime as datetime),102)
and convert(varchar(10),cast(a.endtime as datetime),102) order by a.endtime
------其他解决方案-------------------- 1、
and a.endtime >= to_date('2012-11-24', 'yyyy-mm-dd')
and a.endtime <= to_date('2012-11-25', 'yyyy-mm-dd')