组合查询问题
我想查询某一段时间范围内,同时还要附加四个“或”选条件,我的语句是这样写的
但总报错,请各位高手指教!(text1.text、text2.text 为日期范围)
Data1.RecordSource = "select * form abc where 日期 between cdate(text1.text) and cdate(text2.text) and 摘要 = '市内1' or 摘要 = '市内2' or 摘要 = '市外1' or 摘要 = '市外2' "
问题点数:0、回复次数:3Top
1 楼chenyu5188(来自东方的狼)回复于 2003-02-01 13:09:12 得分 0
Data1.RecordSource = "select * form abc where 日期 between ' # " & cdate(text1.text) & " # 'and ' # " & cdate(text2.text) & " ' and 摘要 = '市内1' or 摘要 = '市内2' or 摘要 = '市外1' or 摘要 = '市外2' "
Top
2 楼chenyu5188(来自东方的狼)回复于 2003-02-01 13:09:55 得分 0
Data1.RecordSource = "select * form abc where 日期 between ' # " & cdate(text1.text) & " # ' and ' # " & cdate(text2.text) & " ' and 摘要 = '市内1' or 摘要 = '市内2' or 摘要 = '市外1' or 摘要 = '市外2' "
Top
3 楼qzbirdman(qzbirdman)回复于 2003-02-05 20:07:32 得分 0
你的数据库是在SQL或者Access?
SQL: "select * from abc where 日期 between convert(datetime,'"+text1.text+"'",11) and convert(datetime,'"+text2.text+"'",11)"
Access: "select * from abc where 日期 between datevalue('"+text1.text+"')" and datevalue('"+text2.text+"')"Top




