Re: [SQL] SQL generator

2006-07-25 Thread Jonah H. Harris
> A typical query then may look like this: > > Select all 'toys' from 'Walmart' where average_sales(100) > 10 and > avaerage_cost(100,10) <= 1 and item_date between "01-Jan-00" and > "01-Jan-06" See Microsoft's English Query for SQL Server or the SQ-HAL project for examples: http://www.micr

[SQL] Storing an ordered list

2006-07-25 Thread Michael Artz
What is the best way to store and ordered list that can be updated OLTP-style? A simplified problem is that I have an event, and the event has an ordered list of predicates and I need to preserve the order of the predicates. All of the data is entered via a web application, and I would like to s

Re: [SQL] About Div

2006-07-25 Thread Ross Johnson
Otniel Michael wrote: Mr. Aaron. I am sorry, your solution didn't match in my case. Example for your solution : A = 1 B = 1 C = 1 D = 1 E = 1 F = 1 G = 4 G have 4 candy. Its too much for G. In my case, the solution is : A = 1 B = 1 C = 1 D = 1 E = 2 F = 2 G = 2 The extra candy is given to thr

Re: [SQL] About Div

2006-07-25 Thread Otniel Michael
Mr. Aaron. I am sorry, your solution didn't match in my case. Example for your solution :A = 1B = 1C = 1D = 1E = 1F = 1G = 4G have 4 candy. Its too much for G.In my case, the solution is :A = 1B = 1C = 1D = 1E = 2F = 2G = 2The extra candy is given to three child.Do you have the other solution? I ne

Re: [SQL] SQL generator

2006-07-25 Thread Chris Browne
"Bit Byter" <[EMAIL PROTECTED]> writes: > I would like to know what the underlying SQL statement will look > like, so that I can use this knowlege to build a generic parser that > creates SQL statements from the "English like" text, using the > syntax I described above. I seem to recall that Lotus

Re: [SQL] reusing AS

2006-07-25 Thread Andrew Hammond
Gregory Stewart wrote: > I am trying to do something like this: > > SELECT SUM(sales_today) AS sales_today_total, SUM(sales_lastweek) AS > sales_lastweek_total > CASE WHEN sales_today_total = '0' THEN '0'::int4 WHEN sales_lastweek_total = > '0' THEN '0'::int4 ELSE ((100/sales_today_total*sales_las

Re: [SQL] SQL generator

2006-07-25 Thread Andrew Hammond
1) If you don't know how to write the SQL for this, then you might want to ask yourself if you have sufficient expertise to write a tool which generates such queries. 2) I have seen many attempts at query generators. I have yet to see a design which achieves a good balance between simplicity and f

[SQL] Storage of Binary Data

2006-07-25 Thread Aaron Bono
I have a somewhat philosophical question about best practices when storing binary data.For my web projects, we have been storing binary data (like images, PDF's, etc) on the hard drive of the web server instead of the database.  Within the database, we keep information, like whether an image is pre

Re: [SQL] About Div

2006-07-25 Thread Aaron Bono
On 7/25/06, Otniel Michael <[EMAIL PROTECTED]> wrote: Dear All,I have a problem with this case :I have 10 candy for 7 child (A, B, C, D, E, F, G).Table X :code   value ---   A    0     B    0     C    0     D    0     E    0     F    0  

[SQL] About Div

2006-07-25 Thread Otniel Michael
Dear All,I have a problem with this case :I have 10 candy for 7 child (A, B, C, D, E, F, G).Table X :code   value ---   A    0     B    0     C    0     D    0     E    0     F    0     G   0    And I want divide it with this algo