SQL语句查询问题
team_uptime=request.Form("team_uptime")'开始时间team_endtime=request.Form("team_endtime")'结束时间
team_name=request.Form("team_name")'公会名称
user_name=request.Form("user_name")'个人名称
数据的话就这么4个。当这些数据都有值的时候。SQL语句应该是这样写的
set rs=conn.execute("select * from [userpaylog] where hap_time>=team_uptime and hap_time=<team_endtime and team_name=team_name and user_name=user_name")
现在的问题是这样的。要是
team_uptime=team_endtime
SQL语句就变成
select * from [userpaylog] where hap_time=team_uptime and team_name=team_name and user_name=user_name
要是
team_name为空的话
SQL 语句就为
select * from [userpaylog] where hap_time>=team_uptime and hap_time=<team_endtime and user_name=user_name
user_name为空的话
select * from [userpaylog] where hap_time>=team_uptime and hap_time=<team_endtime and team_name=team_name
能不能用IF语句 直接在SQL语句里用这个判断
[ 本帖最后由 kgdipbyve 于 2009-10-24 14:43 编辑 ]