473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Divide Between Select Values

japuentem
I Don't Know If I Can Divide Values Like This

Expand|Select|Wrap|Line Numbers
  1. (select Sum(importe) From Costos, Homolodamaster
  2. Where Costos.cuenta=homologamaster.cuenta
  3. And Fecha='24-07-2007') / (select Sum(ponderacion*noenvios)
  4. From Noenvios1, Homologadet, Homologamaster
  5. Where Noenvios1.origendestino=homologader.origendestino
  6. And Homologadet.idruta=homologamaster.idruta)
  7.  
The First Select Returns 129299 And The Second Returns1821623 And I Need To Divide This Two Values, How Can I Do

Regards
Jul 25 '07 #1
4 1828
ck9663
2,878 Expert 2GB
I Don't Know If I Can Divide Values Like This

Expand|Select|Wrap|Line Numbers
  1. (select Sum(importe) From Costos, Homolodamaster
  2. Where Costos.cuenta=homologamaster.cuenta
  3. And Fecha='24-07-2007') / (select Sum(ponderacion*noenvios)
  4. From Noenvios1, Homologadet, Homologamaster
  5. Where Noenvios1.origendestino=homologader.origendestino
  6. And Homologadet.idruta=homologamaster.idruta)
  7.  
The First Select Returns 129299 And The Second Returns1821623 And I Need To Divide This Two Values, How Can I Do

Regards

why don't you use variable?
Jul 25 '07 #2
why don't you use variable?
i don't know how to use that?
Jul 26 '07 #3
chk ths.......
Expand|Select|Wrap|Line Numbers
  1.  
  2. declare @numerator numeric(18,9)
  3. declare @denominator   numeric(18,9)
  4. select @numerator  = Sum(importe) From Costos, Homolodamaster
  5. Where Costos.cuenta=homologamaster.cuenta
  6. And Fecha='24-07-2007'
  7.  
  8. select @denominator  = Sum(ponderacion*noenvios)   
  9. From Noenvios1, Homologadet, Homologamaster   
  10. Where Noenvios1.origendestino=homologader.origendestino
  11. And Homologadet.idruta=homologamaster.idruta
  12.  
  13. declare @res numeric(18,9)
  14. set @res = @numerator /@denominator   
  15.  
Jul 27 '07 #4
chk ths.......
Expand|Select|Wrap|Line Numbers
  1.  
  2. declare @numerator numeric(18,9)
  3. declare @denominator   numeric(18,9)
  4. select @numerator  = Sum(importe) From Costos, Homolodamaster
  5. Where Costos.cuenta=homologamaster.cuenta
  6. And Fecha='24-07-2007'
  7.  
  8. select @denominator  = Sum(ponderacion*noenvios)   
  9. From Noenvios1, Homologadet, Homologamaster   
  10. Where Noenvios1.origendestino=homologader.origendestino
  11. And Homologadet.idruta=homologamaster.idruta
  12.  
  13. declare @res numeric(18,9)
  14. set @res = @numerator /@denominator   
  15.  
Thank for your help.
Jul 30 '07 #5

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

Similar topics

4
by: Jack Smith | last post by:
Hello, I am working on the following problem. I need a divide and conquer algorithm to solve the following problem. Any help is appreciated. I have a set of coordinates (x,y) and each...
4
by: atse | last post by:
Hi, I have a string: mystring="1234,5678,985,21544,55524,11264, ... ," How can I divide this string into 1234 5678 985 .... 11264
6
by: Nobody | last post by:
I have some code that I am trying to optimize for speed... trying to squeeze every last CPU cycle out... I remembered an old trick where dividing & multiplying can be sped up by using bitshifts...
2
by: Mike Leahy | last post by:
All... I have a query that calculates various using variables from a survey database. As with any survey, there are many instantces of null values. I'm wondering if there is any way to escape...
0
by: Gary Carson | last post by:
Can anyone tell why the query below would throw a divide-by-zero error? The only reason I can see for the error happening would be if SUM() came out to be zero, but this never happens with the...
6
by: Johs | last post by:
I have: int a = 1; int b = 2; double c = a/b; Is it somehow possible to divide these two integers and get the result as a double 0.5? Or do they both have to be declared as doubles?
40
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long...
2
by: JenavaS | last post by:
Hi all, I have a query: SELECT Data.Region, Data.Dept, Data.Year, Data.Month, Data.Week, Data.Elapsed, Data. AS WpComp, Data. AS CpComp, IIf(=53 And ="JAN,WK4",/2,) AS AdjLyComp,...
14
by: Default User | last post by:
Hi, If I have three 64 bit integers and I want to do this operation on them: x*y/z Lets say that what we are multiplying by (y) is offset by what we are dividing by (z) so that the final...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.