How to choose the last rate in SQL?
Dear friends,
I have a table named pr_master
There are the item_id, pr_date, and item_rate fields in the table
data are as below
item_id pr_date item_rate
21 01/01/2014 50
21 01/05/2014 45
01/09/2014 21, 44
01/05/2014 25, 115
15/01/2014 25, 110
17/01/2014 25, 125
I want the maximum date through SQL for specific item rate.
Any1 can help. Thanking you.
Kind regards
with
pr_master as
(select 21 item_id, to_date('01-01-2014','dd-mm-yyyy') pr_date, 50 item_rate union double all the)
Select 21, to_date (May 1, 2014 "," dd-mm-yyyy ""), 45 union double all the
Select 21, to_date (September 1, 2014 "," dd-mm-yyyy ""), 44 Union double all the
Select 25, to_date (May 1, 2014 "," dd-mm-yyyy ""), 115 union double all the
Select 25, to_date (15 January 2014 "," dd-mm-yyyy ""), 110 union double all the
Select 25, to_date (January 17, 2014 "," dd-mm-yyyy ""), 125 of the double
)
Select item_id, pr_date, item_rate
of (item_id, pr_date, item_rate, row_number (select) on rn (partition by item_id arrested by pr_date desc)
of pr_master
)
where rn = 1
ITEM_ID | PR_DATE | ITEM_RATE |
---|---|---|
21 | 09/01/2014 | 44 |
25 | 17/01/2014 | 125 |
Concerning
Etbin
Tags: Database
Similar Questions
-
How to choose the following data using sql?
Hi people,
I use oracle 10g.i have two tables as follows.
Now the task is to display the details of the software that has been developed in the language which is neither the first nor the second jurisdiction of the programmer.can u pls help me solve it.thanks in advance.PROGRAMMER PNAME DOB DOJ SEX PROF1 PROF2 SALARY ------------------------------ --------- --------- ----- ------------------------------ ------------ ALIAF 02-JUL-64 02-JUL-90 M CLIPPER COBOL 2800 JULIANA 31-JAN-68 31-JAN-60 F COBOL DBASE 3000 KAMALA 30-OCT-68 30-OCT-92 F C DBASE 2900 MARY 24-JUN-78 24-JUN-91 F C++ ORACLE 4500 NELSON 11-SEP-65 11-SEP-89 M COBOL DBASE 2500 PARTICK 10-NOV-65 10-NOV-90 M PASCAL CLIPPER 2800 QADIR 31-AUG-65 31-AUG-91 M ASSEMBLY C 3000 RAMESH 03-MAR-67 03-MAR-91 M PASCAL DBASE 3200 REBECCA 01-JAN-67 01-JAN-90 F BASIC COBOL 2500 REMITHA 02-DEC-69 02-DEC-92 F PASCAL BASIC 3600 REVATHI 02-DEC-69 02-DEC-92 F PASCAL BASIC 3700 VIJAYA 14-DEC-65 14-DEC-92 F FOXPRO C 3500 ANAND 21-APR-66 21-APR-92 M PASCAL BASIC 3200 SOFTWARE PNAME TITLE DEV_IN DCOST SCOST SOLD ------------------------------ ------------------------------ -------------------- --------- ------- ANAND PHARACHUTES BASIC 6000 400 43 ANAND VIDEO TITLLING PACK PASCAL 16000 7500 9 JULIANA INVENTORY CONTROL COBOL 3500 3000 0 KAMALA PAYROLL PACKAGE DBASE 20000 9000 7 MARY FINANCIAL ACCOUNT ORACLE 85000 18000 4 MARY CODE GENERATOR C 20000 4500 23 PARTICK READ ME C++ 900 2000 84 QADIR BOMBAS AWAY ASSEMBLY 5000 750 11 QADIR VACCINES C 3400 1900 21 RAMESH HOTEL MANAGEMENT DBASE 35000 12000 4 RAMESH DEAD LEE PASCAL 4500 600 73 REMITHA PC UTILITIES C 5000 725 51 REMITHA TRS HELP PACKAGE ASSEMBLY 6000 2500 6 REVATHI HOSPITAL MANAGEMENT PASCAL 75000 1100 2 REVATHI QUIZ MASTER BASIC 2100 3200 15
Reg
vidsNow the task is I have to display the details of the software that has been developed in the language which is neither the first nor the second skill of the programmer
SELECT s.* FROM software s, programmer p WHERE s.pname = p.pname AND s.dev_in NOT IN ( p.prof1, p.prof2 );
-
How to get the last date of 3 days for the current month?
Hello. Guy
How to get the last date of 3 days for the current month?
MY OUTPUT WOULD LOOK LIKE THIS
JANUARY 29, 2016
JANUARY 30, 2016
JANUARY 31, 2016
GUYS HELP ME / / /...
SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">=>
LAST_DAY)
---------
29 JANUARY 16
30 JANUARY 16
31 JANUARY 16
-
How to get the last day of the week?
HII
I can get the week number of calendar for a given date using
SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual
can any body tell me, how to get the last day of the week?
and the answer should be: 04/08/2011(8th april)
Thank you
San
Published by: sandeep9 on April 4, 2011 03:50Perhaps this...
SQL> select trunc(sysdate,'WW')+6 from dual; TRUNC(SYSDATE,'WW')+ -------------------- 08-APR-2011 00:00:00 SQL>
-
How to choose the display by default when you use two screens on my Mac Pro?
How to choose the display by default when you use two screens on my Mac Pro?
The default view when you have several is made that you drag the little icon in the menu bar in this pane:
.
-
I just shared (exported) a project that is a simple take a clip for a friend who has downloaded on its website. The problem is that, when the video ends by playing on his site, he returned to a freeze frame that seems completely random and is not the image I want. How to choose the exact image that the video will return as "thumbnail by default?"
Thank you
Kevin
Cannot set lla at the FCC. Many layout site Web apps will allow you to set the poster frame for the video files.
-
How to choose the download location? download automatically to the users in c drive folder... I want to change my office... Please help me out...
Tools-> Options-> save-> click on the Browse button and find the folder where you want to save the files.
-
How to calibrate the heart rate monitor?
How to calibrate the heart rate monitor that shows a too high concentration?
Hello
It is not possible to calibrate the heart rate sensor. However, various factors can affect the performance of the detector.
During training, to optimize the performance of the heart rate sensor, ensure that you wear your watch fits on top of your wrist.
Apple suggests that consider you the clamping Strip before starting a workout and it loosen again thereafter.
The sensor is likely to give better results for the workouts that involve rhythmic (for example running) rather than the irregular movements (e.g., tennis). Other problems that can affect the performance of the sensor include the perfusion of the skin and wrist tattoos.
More information:
Your heart rate. What it means, and where on Apple Watch you will find. -Apple Support
-
HP pavilion 15-e034tx: how to choose the right RAM for laptop
How to choose the right RAM for my laptop (Pavilion 15-e034tx). I know I should buy DDR3 ram.
Are there other factors should I consider when buying one? I got 2 slots for ram, which od these combos are possible?
1-4 + 4 GB
2-4 GB + 8 GB
3-8 GB + 8 GBThank you
From the Manual:
Two customer accessible/upgradable memory module slots
Support for dual channel DDR3L (1600 MHz)
Support 8192 MB RAM system in the following configurations:
8192 MB (8192 MB × 1, × 4096 MB 2)
See page 53 for instructions. Memory access is easy via the service Panel. This is the part number for the approved 4 HP concert module:
4 GB (PC3L, 12800, 1600 MHz) 691740-001
A 8 GB module is listed in the manual, and it's a 3rd generation of processor i5 I suspect 2 x 8 = 16 concerts would work, but strictly following the manual your only option is to add a 4 GB for a total of 8. Most users really not more 8 GB and adding a second identical module will allow two-channel operation, so you should see a noticeable jump in the overall performance.
If it's 'the Answer' please click on 'Accept as Solution' to help others find it.
-
4540 proBook s: how to choose the right network driver
Hello guys. I clean installed Windows 7 Professional. Now, I see that I can not connect my computer to the internet, so I need to install the network drivers. I wen to the HP website and saw that there are 19 different network for my laptop drivers.
How to choose the right method?Hello:
Below are the links to the ethernet and wireless drivers you need...
Wireless:
This package contains the installation package driver for Ralink wireless LAN controllers in the laptop models running a supported operating system.
File name: sp66089.exe
This card also needs a bluetooth driver...
This package contains the OS driver installation package for the Ralink Bluetooth in laptop computers running taken in charge.
File name: sp59632.exe
Ethernet:
This package provides the driver for the Ethernet Realtek controller in the laptop models running a supported operating system.
File name: sp63213.exe
-
How to increase the sampling rate in this VI?
Hi all
I have recently inherited this mess of a VI and can not figure out how to increase the sampling rate. I tried to change the "ms of waiting ' clock, but it does not add more data points." The main VI, as well as the Subvi, which contains a Daq Assistant to a load cell and LVDT is attached. Any ideas on how to improve the sampling without a complete overhaul would be greatly appreciated!
Thanks in advance!
If you are grateful, feel free to give congratulations and mark the topic as resolved.
-
How to choose the slot one of the two bunk?
How to choose the slot one of the two bunk?
Select the two points to cross the selection with the open selection tool, and then clear the high point on the page by holding shift and clicking on it.
or vice versa. Select the high point of the page first and then select now shift. the high point of the page désélectionnera.
-
Hi all
How to choose the value of a string are letters (for example, TEST) and all numeric...
for example
TEST 123456
TEST 34567
123456 ABCD
1234 TEST
TESTING 12345
TEST 1@234$
YOUR T 123456I want the results of the query as below.
TEST 123456
TEST 34567And I tried to use regexp_like in this case but without success. See the code below.
SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');How can I do this, please answer.
Thank you
WF
If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?
How about this:
SELECT *.
FROM my_table
WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')
-
How to take the last 7 digits of a varchar column
How to take the last 7 digits of a varchar2 colum
COL1
12345678
12345
1234567890123
1234567
Out put should be as below
COL1
2345678
12345
7890123
1234567
everything built in function or in any other way please
Hello
assuming that the entry contains only numbers, as in the example, the addition of 7 spaces to the left and selecting the 7 last characters toured:
with dataset as
(select col1 from column_value
table
(dbmsoutput_linesarray
("12345678"
'12345 '.
'1234567890123'
"1234567".
)
)
)
Select col1
, substr (lpad (", 7,' ') | col1-7) col1_last7
of the dataset
/
COL1 COL1_LAST7
-------------------- --------------------
12345678 2345678
12345 12345
1234567890123 7890123
1234567 1234567
Rob
-
How long is the last free trial?
How long is the last free trial before purchising?
The free trial for 30 days.
Concerning
Hervé Khare
Maybe you are looking for
-
I have a pix of a quilt in a document. I would like to print the page of the document to 400% to allow me to see the quilt better. When I put in my percent effects, it prints the entire document and will not allow me to move to other pages. He says h
-
R7800 cannot see shared folders SMB VPN
Hello I started to use VPN on the R7800 service, and I can use Remote Desktop connection Microsoft 9.3 iOS app to connect to my computer at home (8.1 Windows) through the internet, as if I was on the LAN (192.168.1.2). However, the apps that read SMB
-
No connection to windows with the TrueSuite 3.0
Hello Today, I downloaded and installed the TrueSuite 3.0. The problem is that my connection to Windows7 does not work on the fingerprint. The program says, he knows my fingerprint, but my identity control. Former Toshiba software worked without prob
-
Outlook express, address book change the way
How can I change the path of my outlook express address book?
-
By pressing the delete button puts the Vista computer to sleep
Original title: Remove button puts computer sleep When I push the button Delete on my computer, it puts the computer to sleep. How can I change this? I have a Windows Vista program.