473,324 Members | 2,535 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,324 software developers and data experts.

Pick until enough

[Note] this question is cross-posted to 3 unrelated ngs. Please followup
only to 1.

Hi,

How can I do this:
select g_name from goods order by g_priority where sum(g_value) < 500

I.e., I want to orderly pick from table goods so that the total picked
value is less than a defined value.

Certainly the above sql won't work (tested under mysql). How can I do it?
Thanks!

--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
- All free contribution & collection
Jul 23 '05 #1
1 1196
* Tong * wrote:
[Note] this question is cross-posted to 3 unrelated ngs. Please followup
only to 1.

Hi,

How can I do this:
select g_name from goods order by g_priority where sum(g_value) < 500

I.e., I want to orderly pick from table goods so that the total picked
value is less than a defined value.

Certainly the above sql won't work (tested under mysql). How can I do it?
Thanks!

select g_name from
(select sum(g_value) over(order by g_priority) as running_sum,
g_name from goods) as g where running_sum < 500

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Gary Mayor | last post by:
Hi, If I have the ' character within the javascript:pick command it doesn't work. Is there some sort of way of escaping these characters like in server side languages. function pick(symbol) {...
2
by: * Tong * | last post by:
this question is cross-posted to 3 unrelated ngs. Please followup only to 1. Hi, How can I do this: select g_name from goods order by g_priority where sum(g_value) < 500 I.e., I want to...
4
by: Jerry Camel | last post by:
I'm using a DHTML dialog to present a pick-list to a user. I've got the dialog working using some client side vbscript with a call to window.ShowModalDialog. I can see that the result is being...
5
by: Stuart McDougall | last post by:
Hi, I'm new and naive at JS, but use a lot of modified JS snippets in web design. I'm working on a six-language site for a client right now that has a small nav bar at the bottom of each...
6
by: Ole | last post by:
Hi, I'm running a command line process from my C# application trying to catch the output messages from the process into a textbox in my windows form. But the text doesn't update (the ReadLine...
7
by: Thomas Nelson | last post by:
Occasionally someone posts to this group complaining about the lack of "repeat ... until" in python. I too have occasionally wished for such a construct, and after some thinking, I came up with...
0
by: =?Utf-8?B?TmVpbGUgQmVybXVkZXM=?= | last post by:
Hi there...i don't know if this is more an IIS thing or a .net thing, but i'm trying to figure out why it is sometimes required for the IISAdmin service to be restarted in order for changes to the...
13
by: Martin Sand Christensen | last post by:
Hi! First a bit of context. Yesterday I spent a lot of time debugging the following method in a rather slim database abstraction layer we've developed: ,---- | def selectColumn(self,...
36
by: Krustov | last post by:
What is wrong with this php code ? . (it works fine - but something that just works isnt good enough for this newsgroup is it) <?php $loopy=1; $kon="repo"; $spock=0;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.