473,890 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help dividing two values from different tables.

2 New Member
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#Consumpt ion#RP_Consumpt ion_Gas
2 - PDE#HD#SpeedCur ves#Productivit y

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#Consumpt ion#RP_Consumpt ion_Gas gives me the cas consumed and the V table of

PDE#HD#SpeedCur ves#Productivit y 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("D 1")

Dim hoje
Dim dia

If DayForm = "" OR DayForm = 0 Then hoje = true

If hoje Then _
Set rs = conn.Execute("S ELECT

convert(varchar ,PDE#HD#Consump tion#RP_Consump tion_Gas.T,108) ,(PDE#HD#Consum ption
#RP_Consumption _Gas.V/PDE#HD#SpeedCur ves#Productivit y.V) As Consumo FROM

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas INNER JOIN PDE#HD#SpeedCur ves#Productivit y ON

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T = PDE#HD#SpeedCur ves#Productivit y.T WHERE

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T > DATEADD(dd, -1, GetDate()) ORDER BY

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T") _
Else _
Set rs = conn.Execute("S ELECT

convert(varchar ,PDE#HD#Consump tion#RP_Consump tion_Gas.T,108) ,(PDE#HD#Consum ption
#RP_Consumption _Gas.V/PDE#HD#SpeedCur ves#Productivit y.V) As Consumo FROM

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas INNER JOIN PDE#HD#SpeedCur ves#Productivit y ON

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T = PDE#HD#SpeedCur ves#Productivit y.T WHERE

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T > convert(date, DATEADD(dd, " & DayForm & ", GetDate())) AND

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T < convert(date, DATEADD(dd, " & DayForm+1 & ", GetDate())) ORDER BY

PDE#HD#Consumpt ion#RP_Consumpt ion_Gas.T ")
Jul 14 '07 #1
0 928

Sign in to post your reply or Sign up for a free account.

Similar topics

14
3242
by: Bruce W...1 | last post by:
I do a query to MySQL using PHP. Well actually I do too many of them which is the problem, it's too slow. I think maybe an inner join or something would be better but I can't figure this out. The web page on which the data is displayed has a list of countries. Each country has a label heading under which websites are listed that have information on that country. Any given website may appear many times (under different countries) if it...
0
482
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having trouble making it work in SQL Server 2000. I am not a database newbie, but I can't seem to figure this one out so I am turning to the newsgroup. I am thinking that some of the SQL Gurus out there have done this very thing a thousand times before...
9
2947
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
17
2362
by: Phil McKraken | last post by:
I am having a problem putting together a shopping cart with the below script. Everything displays fine, adds totals fine, and works perfect EXCEPT if you choose the 9.95 item #5 BY ITSELF the total displayed is $9.94 ! If you add ANYTHING else the total is correct, 9.95 plus whatever you add. That is the only price in these samples that is doing that. All the others display properly. If you change the 9.95 to ANY other number it displays...
8
1997
by: newbie | last post by:
hello How can I update more than one tables on the same form? The relationship is one to many from a master table to 3 other related tables. on the form, I have to setvalue for a few fields(colums) in the related tables based on the value I enter in the field from the master table. I kept getting "you have to save the record before you update..." kind of message. Do you have any idea how to handle this? I feel I have to set the master...
13
2497
by: scorpion53061 | last post by:
Very urgent and I am very close but need a little help to get me over the edge........ I need to write these columns to a html file with each row containing these columns (seperated by breaks). Currently this code write all columns to a single row which works but is not what the boss wants. If anyone has suggestions how you would do a report like this I very much would like to hear them as well. vb.net windows app. ...
4
4627
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
4
3360
by: blake15 | last post by:
Hey, I'm desperate for a clue in on how ms access can do this: I'd like take the maximum value from one field and then populate another field by dividing the values of the first field by the max. An Example: Field 1 Field 2 1 = 1/3 2 =1/3 3 =3/3
5
2380
by: Burt | last post by:
There's an architect at my 200 person company that advocates having many layers in all my C# apps. He wants web services, use case handlers, facade layers, data gateways, etc. When I ask why all this complexity is necessary, he gives me what if scenarios: "What if you ever want to access the business logic with another front end?", for example. These are typical "intranet apps"...one or more screens selecting and updating rows in a...
0
1091
by: recruta42 | last post by:
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...
0
9819
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4674
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4270
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3275
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.