... WHERE ( rtrim(ltrim(a.usr_rybm)) = 'liujx' OR rtrim(ltrim(a.reply_rybm)) = 'liujx') and cast(a.turn_time as datetime)>'2005-3-16 10:59:44' and cast(a.turn_time as datetime)<'2005-6-14 10:59:44'
你的语句看不出有什么错误,建议你分部测试下你的数据 1)WHERE ( a.usr_rybm = 'liujx' OR a.reply_rybm = 'liujx') 2)WHERE a.turn_time>'2005-3-16 10:59:44' 3)WHERE a.turn_time<'2005-6-14 10:59:44' 4)WHERE a.turn_time>'2005-3-16 10:59:44' and a.turn_time<'2005-6-14 10:59:44' 5)WHERE ( a.usr_rybm = 'liujx' OR a.reply_rybm = 'liujx') and a.turn_time>'2005-3-16 10:59:44' and a.turn_time<'2005-6-14 10:59:44'
1)WHERE ( a.usr_rybm = 'liujx' OR a.reply_rybm = 'liujx')
2)WHERE a.turn_time>'2005-3-16 10:59:44'
3)WHERE a.turn_time<'2005-6-14 10:59:44'
4)WHERE a.turn_time>'2005-3-16 10:59:44' and a.turn_time<'2005-6-14 10:59:44'
5)WHERE ( a.usr_rybm = 'liujx' OR a.reply_rybm = 'liujx') and a.turn_time>'2005-3-16 10:59:44' and a.turn_time<'2005-6-14 10:59:44'