need the out put based on max date [message #633896] |
Fri, 27 February 2015 03:24 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi all,
create table xxc_transctions(INVENTORY_ITEM_ID number,LAST_INVOICED_DATE date, COST_AMOUNT number,SALES_AMOUNT number);
insert into xxc_transctions(1234,to_date('7/14/2014'), -410, -1086.5);
insert into xxc_transctions(1234,to_date('6/23/2014'), -1335,-3537.75);
insert into xxc_transctions(1234,to_date('5/14/2014'), 0, 0);
insert into xxc_transctions(1234,to_date('5/23/2014'), 0,0);
INVENTORY_ITEM_ID LAST_INVOICED_DATE COST_AMOUNT SALES_AMOUNT
1234 7/14/2014 -410 -1086.5
1234 6/23/2014 -1335 -3537.75
1234 7/14/2014 0 0
1234 6/23/2014 0 0
--------------- --------------
-1745 -4624.25
I need the below output
INVENTORY_ITEM_ID LAST_INVOICED_DATE COST_AMOUNT SALES_AMOUNT
1234 7/14/2014 -1745 -4624.25
Thanks
|
|
|
|
|
|
|
|
Re: need the out put based on max date [message #633905 is a reply to message #633900] |
Fri, 27 February 2015 04:26 |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
mist598 wrote on Fri, 27 February 2015 09:46Quote:Looks like you want to max the date and sum the amounts. What's the problem?
Hi cookiemonster, after used max date , got the result as shown in the 1st post
The results in the first post were filed under the output needed.
You have got to stop asking half a question.
|
|
|
|
Re: need the out put based on max date [message #633909 is a reply to message #633906] |
Fri, 27 February 2015 05:14 |
gazzag
Messages: 1118 Registered: November 2010 Location: Bedwas, UK
|
Senior Member |
|
|
SQL> create table xxc_transctions(INVENTORY_ITEM_ID number,LAST_INVOICED_DATE date, COST_AMOUNT number,SALES_AMOUNT nu
mber);
Table created.
SQL> insert into xxc_transctions(1234,to_date('7/14/2014'), -410, -1086.5);
insert into xxc_transctions(1234,to_date('7/14/2014'), -410, -1086.5)
*
ERROR at line 1:
ORA-00928: missing SELECT keyword
SQL> insert into xxc_transctions(1234,to_date('6/23/2014'), -1335,-3537.75);
insert into xxc_transctions(1234,to_date('6/23/2014'), -1335,-3537.75)
*
ERROR at line 1:
ORA-00928: missing SELECT keyword
SQL> insert into xxc_transctions(1234,to_date('5/14/2014'), 0, 0);
insert into xxc_transctions(1234,to_date('5/14/2014'), 0, 0)
*
ERROR at line 1:
ORA-00928: missing SELECT keyword
SQL> insert into xxc_transctions(1234,to_date('5/23/2014'), 0,0);
insert into xxc_transctions(1234,to_date('5/23/2014'), 0,0)
*
ERROR at line 1:
ORA-00928: missing SELECT keyword
|
|
|
|
|
Re: need the out put based on max date [message #633914 is a reply to message #633902] |
Fri, 27 February 2015 08:23 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
mist598 wrote on Fri, 27 February 2015 04:53Quote:Does that mean your problem is solved?
No not solved. I applied Max fun but no use, how to do this can you please help me?
SALES_AMOUNT is based on months like Jan, feb ...
It's amazing how dense you are that after 1000+ posts you do not know how to ask a question or understand that no one know what you are talking about based on what limited info you ALWAYS post. Not once have you ever posted a question that can be answered with a single response. How do people at your job deal with you?
|
|
|
|