Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Help With Query Syntax
Do you know the maximum value that any row has?
SELECT col1, col2, col3, 250 FROM Table1 WHERE quantity1 > 250
UNION ALL SELECT col1, col2, col3, 250 FROM Table1 WHERE quantity1 > 500
UNION ALL SELECT col1, col2, col3, 250 FROM Table1 WHERE quantity1 > 750
UNION ALL SELECT col1, col2, col3, MOD(Quantity1, 250) FROM Table1 WHERE MOD(Quantity1, 250) > 0;
Just a guess,
Brian
On Thu, 09 Nov 2000 16:44:14 GMT, contrapositive <contrapositive_at_my-deja.com> wrote:
>I want to distribute the value of some field over multiple rows. Best
>to explain by example; here's the query I need to modify:
> SELECT col1, col2, col3, quantity1
> FROM table1
>
>Now suppose there's one record in table1:
> 'val1', 'val2', 'val3', 850
>
>I want each record to return quantity in groups of 250. My results
>should look like this:
> val1 val2 val3 250
> val1 val2 val3 250
> val1 val2 val3 250
> val1 val2 val3 100
>
>So the sum of the rows is 850 but the value in each row is not greater
>than 250 (or some other number). How can I accomplish this in Oracle
>(SQL*Plus v3.3.3.0.0)? Thanks for any help at all.
>
>-jk
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Fri Nov 10 2000 - 07:16:08 CST