-
Grouping data into buckets
Does anyone know how to easily query data in a table into 4 equally sized groups? I have a table with roughly 10K rows and I need to query the data in such a way that each group would have 2500 rows.
Thanks in advance.
Steve
-
Try "group by mod(rownum,4)"
Last edited by DaPi; 01-06-2004 at 10:10 AM.
-
ORA-00979: not a GROUP BY expression
how can i do without grouping?
-
Ugh?
Code:
SQL> select mod(rownum,4), count(*)
2 from all_objects
3 group by mod(rownum,4)
4 /
MOD(ROWNUM,4) COUNT(*)
------------- ----------
0 2134
1 2135
2 2135
3 2135
How do I group without grouping ? ?
-
i don't want the count(*).... group by mod(rownum,4)
i want the * .... group by mod(rownum,4)
i mean i want the full row.
-
Sorry rajabalachandra, I have no idea what you are trying to do . . . .
Perhaps you could restate your problem with an example of a table to be processed and the result you want?
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|