Home » SQL & PL/SQL » SQL & PL/SQL » Query required
Query required [message #275884] Tue, 23 October 2007 03:51 Go to next message
kingo
Messages: 13
Registered: October 2007
Junior Member
Hi,

I have a table say there is column with transaction amount.
My requirement is that I need to frame an output like

***************************************************************
Trans_st - Trans_happened - Trans_end
***************************************************************
100 - <DIFF BETWEEN - This should
200 - Trans_end AND - have TRANS_ST
300 - Trans_st> - FOR NEXT DATE
****************************************************************


SO MY OUTPUT LOOK LIKE THIS

***************************************************************
Trans_st - Trans_happened - Trans_end
***************************************************************
100 - 100 - 200
200 - 100 - 300
300 - 0 - 300
300 - 0 - 300
300 - 0 - 300
***************************************************************


please check the doc for the table format.You will get better idea.

  • Attachment: SQL.doc
    (Size: 20.50KB, Downloaded 115 times)

[Updated on: Tue, 23 October 2007 04:08]

Report message to a moderator

Re: Query required [message #275885 is a reply to message #275884] Tue, 23 October 2007 04:16 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).
2/ We don't download doc file, post it in txt
3/ Post a full test case: create table and insert statements

Regards
Michel

Re: Query required [message #275888 is a reply to message #275885] Tue, 23 October 2007 04:24 Go to previous messageGo to next message
kingo
Messages: 13
Registered: October 2007
Junior Member
Please check my attachment you will understand my requirement.


  • Attachment: sql.txt
    (Size: 1.03KB, Downloaded 122 times)
Re: Query required [message #275893 is a reply to message #275888] Tue, 23 October 2007 04:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ Post as requested in point 1 and 3
2/ Explain in details with words what you want

Regards
Michel
Re: Query required [message #275897 is a reply to message #275893] Tue, 23 October 2007 04:47 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Michel has an excellent point: have a look at the forum guidelines.

But, I think you should investigate analytic functions. Especially LEAD() seems to be something for you.

MHE
Re: Query required [message #275900 is a reply to message #275897] Tue, 23 October 2007 04:56 Go to previous messageGo to next message
kingo
Messages: 13
Registered: October 2007
Junior Member
Actually I am new to sql.Can you please help me on this ?
Re: Query required [message #275902 is a reply to message #275900] Tue, 23 October 2007 05:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
With pleasure as soon as you'll post as requested.

Regards
Michel
Re: Query required [message #275904 is a reply to message #275900] Tue, 23 October 2007 05:09 Go to previous message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
kingo wrote on Tue, 23 October 2007 10:56

Actually I am new to sql.Can you please help me on this ?

Absolutely. The best help that we can give is to point you in the direction of the info that you need. I like to use This site, and from there I can search for any oracle related topic to get the syntax, examples, uses etc. Also searching the internet using something like google can often turn up trumps alternatively you could take one or two of the keywords that Maaher provided and even search THIS forum for something like LEAD or ANALYTIC FUNCTION.
Previous Topic: Help needed in Materialized View
Next Topic: sql order by
Goto Forum:
  


Current Time: Wed Dec 07 10:34:40 CST 2016

Total time taken to generate the page: 0.10466 seconds