Help dividing two values from different tables.
Hi, I am completly new in ASP , but, due the necessity of the production in the company I work, I need
urgently to learn do deal with scripts and SQL.
I did a script that shows on the production screen the consume tax of the gas instantly on time and it
worked. Now I have to do a table formed by the DIVISION of a valor V from one table by the valor V in
another table, mas the values must be taken at the same time do give me the gas consumed by ton produced.
Explaining in details:
I have two tabels:
1 - PDE#HD#Consumption#RP_Consumption_Gas
2 - PDE#HD#SpeedCurves#Productivity
Inside each of these tables, there are two columms with the same name for both -> V, T. The V columm of the
table PDE#HD#Consumption#RP_Consumption_Gas gives me the cas consumed and the V table of
PDE#HD#SpeedCurves#Productivity the productivity. The V1/V2 graph must be ploted in a 24 hours period. What
happens is that if I do it for 24 houres, I mean, 1 day, the graph is ploted completly wrong in time! If I
do the same thing, but using only one columm, not the division by another, it works! Why this is happening ?
What is wrong with the following script ?? I need to know the answer for this as fast as possible! If you
need more details, I will give.
The script:
DayForm = Request.Form("D1")
Dim hoje
Dim dia
If DayForm = "" OR DayForm = 0 Then hoje = true
If hoje Then _
Set rs = conn.Execute("SELECT
convert(varchar,PDE#HD#Consumption#RP_Consumption_Gas.T,108),(PDE#HD#Consumption
#RP_Consumption_Gas.V/PDE#HD#SpeedCurves#Productivity.V) As Consumo FROM
PDE#HD#Consumption#RP_Consumption_Gas INNER JOIN PDE#HD#SpeedCurves#Productivity ON
PDE#HD#Consumption#RP_Consumption_Gas.T = PDE#HD#SpeedCurves#Productivity.T WHERE
PDE#HD#Consumption#RP_Consumption_Gas.T > DATEADD(dd, -1, GetDate()) ORDER BY
PDE#HD#Consumption#RP_Consumption_Gas.T") _
Else _
Set rs = conn.Execute("SELECT
convert(varchar,PDE#HD#Consumption#RP_Consumption_Gas.T,108),(PDE#HD#Consumption
#RP_Consumption_Gas.V/PDE#HD#SpeedCurves#Productivity.V) As Consumo FROM
PDE#HD#Consumption#RP_Consumption_Gas INNER JOIN PDE#HD#SpeedCurves#Productivity ON
PDE#HD#Consumption#RP_Consumption_Gas.T = PDE#HD#SpeedCurves#Productivity.T WHERE
PDE#HD#Consumption#RP_Consumption_Gas.T > convert(date, DATEADD(dd, " & DayForm & ", GetDate())) AND
PDE#HD#Consumption#RP_Consumption_Gas.T < convert(date, DATEADD(dd, " & DayForm+1 & ", GetDate())) ORDER BY
PDE#HD#Consumption#RP_Consumption_Gas.T ")