This discussion is archived
11 Replies Latest reply: Jul 27, 2012 3:01 PM by jgarry RSS

Challenged SQL

870050 Newbie
Currently Being Moderated
I want a query that increment a number by one after each certain number of records...
example,
after 3 rows it increases a counter by 1
C V
1 A
1 b
1 c
2 d
2 e
2 f
3 d
3 e
3 f
after 6 rows it increases a counter by 1
C V
1 A
1 b
1 c
1 A
1 b
1 c
2 d
2 e
2 f
2 d
2 e
2 f
3 d
3 e
3 f
3 d
3 e
3 f
  • 1. Re: Challenged SQL
    Osama_Mustafa Oracle ACE
    Currently Being Moderated
    *     *
    Handle:      user6745988
    Status Level:      Newbie
    Registered:      Jun 20, 2011
    Total Posts:      42
    Total Questions:      18 (17 unresolved)

    Please close your threads !!!!!!!!!!!!!!!!!!!!!!!!
  • 2. Re: Challenged SQL
    870050 Newbie
    Currently Being Moderated
    why?
  • 3. Re: Challenged SQL
    Osama_Mustafa Oracle ACE
    Currently Being Moderated
    1-Its Forum Rule
    2-if you need help , you have to close your thread first .
  • 4. Re: Challenged SQL
    870050 Newbie
    Currently Being Moderated
    I don't agree with the rule ..
  • 5. Re: Challenged SQL
    sb92075 Guru
    Currently Being Moderated
    user6745988 wrote:
    I don't agree with the rule ..
    While you are free to ignore the rules, we are free to not answer your questions.
  • 6. Re: Challenged SQL
    870050 Newbie
    Currently Being Moderated
    This is the forum and not HELP DESK, no body is forced to answer any question, just keep it moving.
  • 7. Re: Challenged SQL
    870050 Newbie
    Currently Being Moderated
    For benefit of others... this is the solution

    SQL> select ename,ceil(rownum / 3) from emp;

    ENAME CEIL(ROWNUM/3)
    ---------- --------------
    MILLER 1
    CLARK 1
    KING 1
    ADAMS 2
    SMITH 2
    JONES 2
    FORD 3
    SCOTT 3
    JAMES 3
    MARTIN 4
    WARD 4

    ENAME CEIL(ROWNUM/3)
    ---------- --------------
    ALLEN 4
    BLAKE 5
    TURNER 5

    14 rows selected.

    SQL>
  • 8. Re: Challenged SQL
    sb92075 Guru
    Currently Being Moderated
    amazing change in attitude in only a few hours!

    Handle:     user6745988
    Status Level:     Newbie
    Registered:     Jun 20, 2011
    Total Posts:     47
    Total Questions:     19 (16 unresolved)
  • 9. Re: Challenged SQL
    jgarry Guru
    Currently Being Moderated
    user6745988 wrote:
    This is the forum and not HELP DESK, no body is forced to answer any question, just keep it moving.
    But what about people who waste their time reading questions that ought to have been marked closed? Are you not rudely wasting the time of thousands of people all over the world? If everybody ignores that rule, doesn't the problem compound? (FYI, I ignore that marking in choosing what I read, but I know many or most don't.)

    You might consider that someone with tens of thousands of posts and a rating that says they have been helpful would have good advice about how to deal with this particular forum.
  • 10. Re: Challenged SQL
    870050 Newbie
    Currently Being Moderated
    Bobody is wasting your time, you are wasting your own time. Dont try to be psyo to prove that you can do everything. If you don't want to waste your own time just go to Oracle Support Community. If your job is to monitor this forum, you should take action for someone who is against the rules, even if it is me. So far, I am not going to close the thread that I am not happy with the answers or someone has asked me to do so. We are living in the very complex modern society, if in your mind you think that you are Osama and troubled with someone who is not closing threads, pretty much you need some medical attention before you start killing people.
  • 11. Re: Challenged SQL
    jgarry Guru
    Currently Being Moderated
    But we're DBA's! We can do everything! :p

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points