Home » SQL & PL/SQL » SQL & PL/SQL » ORACLE (10g)
icon5.gif  ORACLE [message #361782] Fri, 28 November 2008 01:36 Go to next message
ssmdesai
Messages: 2
Registered: November 2008
Location: Silvassa
Junior Member
In a table containing records of all customer with there orders and status of deliveries.

Now I wish to find last the entry of each customer available this table, it can be their last order or delivery status.

What would be the ideal query for this? Please help me.
Re: ORACLE [message #361794 is a reply to message #361782] Fri, 28 November 2008 01:58 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@ssmdesai,

Decribe your table or even better please post a test case (CREATE Table Statement and INSERT Statements for some dummy records) and your desired output. Also post what you havee tried so far.

Before the next post, please read OraFAQ Forum Guide especially on "How to Format Your Post?" section.

Finally, in future please select a meaningful title which gives some idea about the problem you are facing. The title "ORACLE" in an Oracle Forum won't be helpful.

Regards,
Jo
Re: ORACLE [message #361805 is a reply to message #361782] Fri, 28 November 2008 02:24 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Also post your Oracle version (with 4 decimals).

Regards
Michel
icon5.gif  Re: Find out last entry for each item & cost grp [message #361815 is a reply to message #361782] Fri, 28 November 2008 02:51 Go to previous messageGo to next message
ssmdesai
Messages: 2
Registered: November 2008
Location: Silvassa
Junior Member
Please find attached file... as exmaple & Please provide the solution.../fa/5369/0/
Re: Find out last entry for each item & cost grp [message #361822 is a reply to message #361815] Fri, 28 November 2008 03:17 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Some of us don't want or can't download files, so post a test case: create table and insert statements in text along with the result you want with these data.

Regards
Michel
Re: Find out last entry for each item & cost grp [message #361839 is a reply to message #361815] Fri, 28 November 2008 04:10 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
ssmdesai
I wish to find last the entry of each customer available this table, it can be their last order or delivery status.

As long as you know the way to uniquely identify the last entry, no problem. It may be, for example, a timestamp or a sequence number.

In your case, regarding the image you provided, it appears that the "sno" column is the one we are interested in. If that's so, piece of code you might use could be
...
and t.sno = (select max(t1.sno) 
             from table t1
             where t1.id_column(s) = t.id_column(s)
            )

Try to write the whole query by yourself; do come back if there are still problems you can't solve.
Previous Topic: Need help in SQL query
Next Topic: Help urgent....
Goto Forum:
  


Current Time: Sun Dec 11 00:13:26 CST 2016

Total time taken to generate the page: 0.05013 seconds