How can I return results based on 2 columns?
I have had a problem and it cannot know for life. First of all, here is a series of example data that I use so you can see exactly what I'm asking.
EmplId Effdt Effseq
10001 1 JANUARY 99 ' 0
10001 1 JULY 11 ' 0
10001 1 JULY 11 ' 1
10001 1 JULY 11 ' 2
10001 1 JULY 12 ' 3
Do I have to do here is get 3 ranks. 3 rows, I need are lines 1, 4 and 5. I need rank 1 because it's a different date. I need line 5 for the same reason: it is another date. The question arises with how I can get the rank 4. The problem is that the lines 2, 3, 4, and all have the same date (effdt) effective, Developer SQL just returned one of these lines. Because these 3 rows all have the same date (effdt) effective the switch becomes the actual sequence number (effseq). When the date (effdt) effective is the same, you enter the maximum number of sequence (effseq) effective and return results of this whole line as the emplid, effdt and effseq. It seems so simple and something that you can use a subquery for, but its not as simple as that. Note, that you can specifically use the emplid = 10001 in any specific form because there are many employee also id, the lines will not be in a specific order so that you can always just grasp the lines 1, 4 and 5. Some employees may have only a single line in the database, and some may have 50 lines. Everything depends only on the combination of employee id (emplid) date (effdt) efficient and effective sequence (effseq) as the tiebreaker. Any help to fix this would be greatly appreciated. Thank you in advance.
WITH t AS (SELECT 10001 emplid, TO_DATE ('01-JAN-1999', 'dd-mon-yy') effdt, 0 effseq FROM DUAL UNION ALL SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 0 FROM DUAL UNION ALL SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 1 FROM DUAL UNION ALL SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 2 FROM DUAL UNION ALL SELECT 10001, TO_DATE ('01-JUL-2012', 'dd-mon-yy'), 3 FROM DUAL) SELECT emplid, effdt, effseq FROM (SELECT t.*, ROW_NUMBER () OVER (PARTITION BY emplid, effdt ORDER BY effseq DESC) rn FROM t) WHERE rn = 1
EMPLID | EFFDT | EFFSEQ |
---|---|---|
10001
|
01/01/1999 |
0
|
10001
|
01/07/2011 |
2
|
10001
|
01/07/2012 |
3
|
Tags: Database
Similar Questions
-
How can I return a result of popup to parent form
Hi guys
This is probably a very simple question.
How can I return a result of popup to parent form?
Thank you
Hi dpolonsky,
due to the fact that your screen popup and parent are in classes separated.
So create your own set and get methods/functions that can be called from another class.
Because the variables are known only in the class, they were defined (information hiding), then you must use the functions/methods, that affects the apropriate values.
in your parent class, you can define a method like:
void setFromPopup (int intval) {}
intval = globalintvalfrompopup; globalintcalfrompopup is declared globally within your class
}
and in your child (popup) class, you can call via
.
.
int TestInt = 10;
parentclass.setFromPopup (testint);
.
.
It is a general question of JAVA.
Hope it helps.
-
I use the beta version, how can I return to the basis of Firefox?
How can I return to the basis of Firefox instead of the beta?
Backup of your profile and you will not lose your add-ons and bookmarks.
-
How can I return Ipad lost the Original owner
How can I return Ipad lost to the Original owner. I found this in a restaurant and he didn't. is it possible to give that ipad
Of course, follow this:
Report a lost or stolen - Apple Support Apple product
Please send back
EDIT: of course, you can leave in the police station the nearest and the report as lost, place, time, etc. or to personnel in the site you found.
-
How can I return to 4.0 3.6 I've never had a problem with 3.6 and now 4.0 crashes all the time tell me how to go back
Downgrade to Firefox 3.6 first of all uninstall Firefox 4, but do not select the option 'remove my Firefox personal data '. If you select this option, it will delete your bookmarks, passwords and other user data.
Then you can install the latest version of Firefox 3.6 available to http://www.mozilla.com/en-US/firefox/all-older.html - it will automatically use your favorite courses, passwords etc.
I recommend, to avoid possible problems with decommissioning, accessing your profile folder and delete the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Delete these files will force Firefox to rebuild the list of installed extensions, check their compatibility and cancel the toolbar customizations.
For more information on how to find your profile folder, see https://support.mozilla.com/kb/Profiles
-
After a recent update the keyboard appears in the center of the screen, rather than at the end. How can I return it down?
Press and hold the keypad icon bit, then slide your finger up to 'Dock '.
-
my audio syestem of beats went when I choose windows 8, how can I return it with the full version? I have hp pavilion dv4 5110tx
Hello
Try the following.
Download IDT Audio Installer on the link below and save it in your downloads folder.
http://ftp.HP.com/pub/SoftPaq/sp59501-60000/sp59882.exe
One time finished, open windows control panel, open Device Manager and open sound, video and game controllers. Right click on the IDT device and select uninstall - also, you should get a command prompt to delete the current driver, check the box allow this and then proceed to uninstall.
Then, download and reinstall the Chipset driver on the following link.
After reinstalling, restart the laptop and let Windows load completely. Open your download folder, right-click on the IDT Installer and select "Run as Administrator" to launch the installation. When this has completed, restart the computer again before checking if the Beats Audio is now listed in the windows control panel.
Kind regards
DP - K
-
How can I return the path of a test step VI in LabVIEW?
I would create a VI that will return all of the VI paths that are associated with the test steps in a TestStand sequence. How can I return the path of the VI associated with a test step? Here is a starting point that will return the first step of the sequence.
You must convert the Module to a LabVIEWModule (use the variant to the data node), then you can use LabVIEWModule.VIPath. If you use TestStand 2010, you can call LabVIEWModule.GetVIAbsolutePath to find the VI in the case you are calling with a project.
-
How can I return my computer dell laptop to factory settings
How can I return my lap top to factory settings
-
How can I return the audio for my lap top.
Original title: audio sound
I inadvertently deleted something that gives me sound on my lap top. I think it is silverlight. How can I return the audio for my lap top. THX
Hello
1 have had any changes made on the computer before the show?
2. what operating system is installed on the computer?
3. when exactly do you face the question?
I suggest to return the item and try to run the fix it:
No sound in Windows
http://Windows.Microsoft.com/en-us/Windows/help/no-sound-in-Windows
Please provide more information to help you best.
-
How can I return my T5i factory settings?
How can I return my T5i factory settings? I have problems with flash and counting and thinking, I may have inadvertently changed a setting. Appreciate any help. Thank you
Yes
-
I pressed a button on the accident and he took off to be a Director. Now, I am not recognised and cannot do things on my computer. How can I return my administrator status?
Log in as the built-in Administrator and change yourself (or leave you the user account and only use the administrator account if necessary.)
-
My laptop display orientation has changed, how can I return to normal
My daughter has changed somehow NLE orientation of the display on our laptop. How can I return it to normal before my neck suffers irreparable damage?
Hello
Try to press Ctrl + Alt + up ARROW, or try Ctrl + Alt + and a different key to the arrow.
If this does not work: right-click on empty office rotation - graphics options.
-
Lost normal Explorer... says failed... can only get the shortcut... How can I return... thanx
You don't say what Explorer!
There are Explorer Windows and Internet Explorer.Restore point:
http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/
Do Safe Mode system restore, if it is impossible to do in Normal Mode.
Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.
Try a restore of the system once, to choose a Restore Point prior to your problem...
Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.
See you soon.
Mick Murphy - Microsoft partner
-
How can I return my computer to the factory setting.
How can I return my computer to the factory setting.
Maggie,
This facility will be provided by your computer manufacturer [is not part of Windows 7]. You will need to check the manual of your computer or the computer manufacturer's website for instructions.
Denis
Maybe you are looking for
-
Unlocked IPhone connected to a carrier
Hi all My friend who went to the U.S.A. recently bought an iPhone 6 s for me. Today, she sent an e-mail me the reception and it says that the device is bought in * full price * connected to the carrier of Sprint. So, it means that it's unlocked? I li
-
View report TestStand in modular VI
Hi all I am creating a VI (LabVIEW 2011) which is called from TestStand (2010). The purpose of this VI will display the results of the test at the end of a test sequence. The VI must contain a button that the user can press to close and continue. My
-
XP freezes before loading personal settings
XP STARTS TO LOAD THEN GOES TO BLUE SCREEN, MOUSE ŒUVRES BUT CAN'T DO
-
Keep all programs and files on a CD, so there is nothing on the computer
Hello In years past, I used to keep all my files and programs on a "floppy". I can do this in Vista, so there is nothing but the OS and the A / virus on the HARD drive, and when I use the computer, I just loaded my CD, and then select the files or th
-
Taskbar Wizard of PayPal payment request
I am trying to install the PayPal payment assistant task bar. Everything seems fine, but it does not install on Outlook. Any help!