473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sql query - orcale database.. Need to retrieve a row with generic condition

Expand|Select|Wrap|Line Numbers
  1. empid    emplrcd   effdt   effsq
  2. 101          #1    2/1/99    0
  3. 101          #1    3/1/13    1
  4. 101          #1    23/3/13   1 
  5. 101          #1    22/6/13   2
  6. 102          #2    20/6/91   1
I need to retrieve row 4, and I have written a partial code, please help me with the other half.

Expand|Select|Wrap|Line Numbers
  1. select a* from Ps_Job a where a.empid = '101' and a.emprcd ='#1' and a.effdt = (select max(a1.effdt) from Psjob1) where...............
  2. and a.effseq = (Select  max(a2.effseq) from Ps_job2)
  3. where..............
Please help me with the where caluse which should be generic and not row specific. i think it should be filled with nth max concept but not sure.
Oct 10 '13 #1
1 1185
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

Join the table to an aggregate query that returns the max date by empid.
Oct 10 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: hemal | last post by:
I came across a very strange situation at work. There is an order of magnitude difference in execution time for the following two queries (10 v/s ~130 msec): select count(*) from table_name...
3
by: gizmo | last post by:
I have a stored procedure that queries a database using a Select statement with some inner joins and conditions. With over 9 million records it takes 1 min 36 sec to complete. This is too slow...
0
by: GlenCrinan | last post by:
Hi, I defined mapping for a remote oracle table in a db2 federated db ( db2 8.2 on redhat linux ); the purpose is to access that data from IBM mainframe IMS transactions .. the connection...
7
by: K. Crothers | last post by:
I administer a mechanical engineering database. I need to build a query which uses the results from a subquery as its input or criterion. I am attempting to find all of the component parts of...
2
by: Sreedhar Vankayala | last post by:
Hi, I have a table IV00108wc which contains several thousand records in whcih ITEMNMBR is the primary key. I have a com+ object returning recordset which has ITEMNMBR and another details...
5
by: nicholas | last post by:
I would like to insert a new record in a Ms Access database and retrieve the newly created ID (autonumber). I would like to do it in VB.NET for an ASP.NET page. ( no asp) I found several...
1
by: Larry Dooley | last post by:
Here's my issue. We've decided to replace a very critical (without it the business would lose lots of money) departmental reporting system with a built from scratch system based on .NET. The key...
1
by: srikalyan | last post by:
I have this C++ program that queries the database on the local host. But if I have to query the database that from a remote machine then what are the commands and libraries that I have to include in...
1
by: newtechiebug | last post by:
I am trying to convert a MS Access Query to a SQL query and I need help with some IIF Statements? 2 in particular that I've encountered problems with are: Count(IIf(=0 Or...
3
by: Max2006 | last post by:
Hi, I have a search result GridView bound to an ObjectDataSource. Once I open the asp.net page, the ObjectDataSource automatically refreshes the GridView which is the default behavior. I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.