It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Hello I need help on this query
I Have folliwing datas
Part OderQty ShippedQty QOH
10510 10 5 10
10510 10 0 10
10510 10 0 10
10511 10 10 20
10511 20 0 20
I need to filter where the sum of OrderQty - sum of Shipped Qty is < QOH.
Example:
Part 10510
total sum Ordered: 30
total sum Shipped: 5
Balance: 25
QOH: 10
I need all part where the condition is like part 10510
the second part number is fine because I needed 30, shipped 10 and have 20 on hand, do you how to write this query for oracle,
Thanks
ld
select part
from your_table
group by part
having
sum(OrderQty) - sum(ShippedQty) < max(QOH)
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I can have different-length integer's...
For example 1896, or 894...
But how can i convert them to float, so that i have only one symbol after comma?
For example
1896 -> 1.9
894 -> 0.9
539 -> 0.5
How can i do this on ruby?
Now i do this so:
type.TYP_CCM.round(-2).to_s[0].concat(".").concat(type.TYP_CCM.round(-2).to_s[1])
But it is bad idea, and is only for 4-digit int...
What about that:
(1896/1000.0).round(1) # 1.9
(894/1000.0).round(1) # 0.9
(539/1000.0).round(1) # 0.5
It's all in the API:
(1234/1000.0).round(1)
should give you one decimal digit after the dot.
Even if it were not in the API, you could easily emulate this via
(1234/100.0).round() / 10.0
or more close to your code:
(1234).round(-2) / 1000.0
As for ensuring that your output has the format xxxx.y - use format strings, http://www.ruby-doc.org/core-1.9.3/String.html#method-i-25
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Imagine a situation when you have a table with 2 million rows and you wanted to delete a million rows. These rows are not bunched together. I might want to delete row1, and then row5, and then may be row7. But I want to deletes rows that may have age < 23 What is the best way to go about deleting these rows?
You will want to delete them in batches. This previous question provides some interesting answers.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How do you use the sleep function to run the bash script every minute for say 6 hours?
Thanks
Wouldn't it be easier to setup a cron job?
min hour day month weekday command
*/1 10-15 * * * /path/to/your/script
10-16 is an example of a six hour block where it would run. 10 being 10AM and 15 being 3PM
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How can we add two dates in oracle? For example in sql we can do this, " date_1 + date_2 " how can we achieve the same thing in Oracle
Adding two dates together would be meaningless but you can add an interval to a timestamp. For example, to add 1 year and 10 months to a timestamp:
SELECT SYSDATE + INTERVAL '1-10' YEAR TO MONTH FROM DUAL;
You can also add days to a DATE column using simple arithmetics. For example, you can add 45 days to the current date using:
SELECT CURRENT_DATE + 45 FROM DUAL;
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a basic math question. I am trying to get a percentage from a range of numbers and the algorithm is troubling me.
Say I have a range of -5 to +5 and I want to know what percentage is in between given a value. I know that -5 would be equivalent to 0% and 5 would be 100%, with 0 being 50%.
I tried to add 5 to bring up the scale, but it just feels like a hack. I would like it to feel dynamic so that I can give it any range and successfully work.
Ex.
percent = (5 + value) * 100 / 10
How do I figure out what value should be the a general case?
range = top_value - bottom_value
percent = (value - bottom_value) / range