Tell me what I am doing wrong here. Maybe I dont have the statement correct.
I am trying to get all the records that are between this date and that date. Ex:
User Input:
User 1
11/10/2002
11/19/2002
My table structure has only one date, basically the date that the work has been completed, no other date. I know how to do it with one date, but I never did it with 2 dates. Anyone can help me here.
SQL:
<%
UserID = TRIM( Request.QueryString( "UserID"
)
SDate = TRIM( Request.QueryString( "SDate"
)
EDate = TRIM( Request.QueryString( "EDate"
)
Set RS = Server.CreateObject("ADODB.Recordset"
SqlString = "SELECT Main.Technician, SUM(Main.TSpent) as TimeSpent, Main.Category, Main.Date1, Technicians.Technician as Tech_Name, Category.Category as Category_Name "
SqlString = SqlString & " FROM (Main INNER JOIN Technicians ON Main.Technician = Technicians.TechID) INNER JOIN Category ON Main.Category = Category.CatID "
SqlString = SqlString & " WHERE Technicians.TechID = " & UserID & " and Main.Date1 <= " & SDate & " and Main.Date1 >= " & EDate
SqlString = SqlString & " Group by Main.Category, Category.Category, Main.Technician, Technicians.Technician, Main.Date1 "
SET RS = objConn.Execute( sqlString )
%>
I am trying to get all the records that are between this date and that date. Ex:
User Input:
User 1
11/10/2002
11/19/2002
My table structure has only one date, basically the date that the work has been completed, no other date. I know how to do it with one date, but I never did it with 2 dates. Anyone can help me here.
SQL:
<%
UserID = TRIM( Request.QueryString( "UserID"
SDate = TRIM( Request.QueryString( "SDate"
EDate = TRIM( Request.QueryString( "EDate"
Set RS = Server.CreateObject("ADODB.Recordset"
SqlString = "SELECT Main.Technician, SUM(Main.TSpent) as TimeSpent, Main.Category, Main.Date1, Technicians.Technician as Tech_Name, Category.Category as Category_Name "
SqlString = SqlString & " FROM (Main INNER JOIN Technicians ON Main.Technician = Technicians.TechID) INNER JOIN Category ON Main.Category = Category.CatID "
SqlString = SqlString & " WHERE Technicians.TechID = " & UserID & " and Main.Date1 <= " & SDate & " and Main.Date1 >= " & EDate
SqlString = SqlString & " Group by Main.Category, Category.Category, Main.Technician, Technicians.Technician, Main.Date1 "
SET RS = objConn.Execute( sqlString )
%>