|
-
Hi,
For the query mentioned above i created this sample table
create table sales
(
Rep_Code Varchar2(50),
Rep_Date Date,
Revenue Number,
Office Char(2)
);
Then inserted values as
insert into sales values('A','1-Jan-2013','0.5M','NY');
insert into sales values('B','1-Jan-2013','0.3M','CA');
insert into sales values('A','5-Jan-2013','1.0M','NY');
insert into sales values('B','7-Jan-2013','1.0M','CA');
insert into sales values('C','6-Feb-2013','0.8M','MT');
insert into sales values('C','8-Jan-2013','1.0M','MT');
insert into sales values('C','11-Feb-2013','0.98M','MT');
insert into sales values('C','12-Feb-2013','1.0M','MT');
Now i wrote this query to fetch the data this will give the desired value, please check
select rep_code, max(rep_date),revenue
from sales
where revenue='1.0M'
group by rep_code,revenue
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|