Home » SQL & PL/SQL » SQL & PL/SQL » How can we do it. (merged)
How can we do it. (merged) [message #378817] Fri, 02 January 2009 00:43 Go to next message
mamalik
Messages: 266
Registered: November 2008
Location: Pakistan
Senior Member

Dear
I am writing a query i have to display serial number with record. Serial number should start from 1 when department number change.

Dept. Sr#. Code
1 1 1
1 2 2
2 1 3
2 2 4
3 1 5
3 2 6

Thanks in advance.

Regards.
Asif.
Re: How is it possible. [message #378820 is a reply to message #378817] Fri, 02 January 2009 00:51 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
You can use the row_number analytic function for your serial number. You can find the syntax in the online documentation. You will learn more if you look it up than if we provide the code.
How can we do it. [message #378825 is a reply to message #378817] Fri, 02 January 2009 01:03 Go to previous messageGo to next message
mamalik
Messages: 266
Registered: November 2008
Location: Pakistan
Senior Member

Dear All

I am displaying serial number in query. I want that serial number should start from 1 when department name in query change. how can we do it in query.????

Thanks in advance.

Best Regards.
Muhammad Asif.


Re: How can we do it. [message #378833 is a reply to message #378825] Fri, 02 January 2009 01:20 Go to previous messageGo to next message
v.ram81
Messages: 50
Registered: April 2006
Location: pune
Member

please do not multipost .
Barbara already answered this in your previous post.
Search for Row_number() analytical function.

Regards,
Ram.
Re: How can we do it. (merged) [message #378840 is a reply to message #378817] Fri, 02 January 2009 01:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In addition and once more, OraFAQ Forum Guide, especially "How to format your post?" section and use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: How can we do it. (merged) [message #378847 is a reply to message #378817] Fri, 02 January 2009 01:53 Go to previous message
mamalik
Messages: 266
Registered: November 2008
Location: Pakistan
Senior Member

Dear All

Thanks


2ndly i am sorry for multi posting. It happened due to my net problem and i thought that my question will not be posted.

Regards.
Asif.
Previous Topic: PL/SQL: ORA-00984: column not allowed here
Next Topic: code practice
Goto Forum:
  


Current Time: Wed Dec 07 10:24:07 CST 2016

Total time taken to generate the page: 0.18375 seconds