473,546 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing a query to get the second highest value in atable by using select statement

1 New Member
writing a query to get the second highest value in atable by using select statement
Sep 12 '07 #1
5 4361
debasisdas
8,127 Recognized Expert Expert
As you have posted a question in the articles section it is being moved to Oracle Forum.

MODERATOR.
Sep 12 '07 #2
debasisdas
8,127 Recognized Expert Expert
writing a query to get the second highest value in atable by using select statement
Kindly post the query that you have tried to solve this.
Sep 13 '07 #3
arulkumara
15 New Member
writing a query to get the second highest value in atable by using select statement
Hi
try this

select level,max(salar y) from emp1
where level=2
connect by prior salary>salary
group by level;

here salary->column
Sep 19 '07 #4
arulkumara
15 New Member
writing a query to get the second highest value in atable by using select statement
Hi
try this

select level,max(salar y) from emp1
where level=2
connect by prior salary>salary
group by level;

here salary->column name
Sep 19 '07 #5
amitpatel66
2,367 Recognized Expert Top Contributor
Hi
try this

select level,max(salar y) from emp1
where level=2
connect by prior salary>salary
group by level;

here salary->column name
Try below Query:

Expand|Select|Wrap|Line Numbers
  1. SELECT min(e.salary) FROM emp e WHERE 2 > (SELECT COUNT(*) FROM emp WHERE salary > e.salary)
  2.  
Sep 19 '07 #6

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

Similar topics

4
2424
by: YoBro | last post by:
Hi, I have a database that stores in a field the number of views for a product. I want to write a query that gets the two highest views, so I can then output the result. I have this so far, but not sure how to adapt it to get the two highest views.
13
2870
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine. Value selected is used as the 'where' clause of the 2nd query. If $site is a single word, the 2nd query works like a charm. If $site is more than one...
8
89293
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON tblMyTable.UniqueID = tblMyTableTEMP.UniqueID SET tblMyTable.myField = tblMyTableTEMP.myField, tblMyTable.myField2 = tblMyTableTEMP.myField2,
1
1232
by: Martin | last post by:
I have a table in which the records a bunch of fields; for this query, I'm interested in three of them - let's call them Fld1, Fld2 and Fld3. For each record in the table, these fields may or may not contain data (a stock ticker symbol - like MSFT, for example). Different records may or may not contain the same symbol in the various fields. ...
3
1821
by: Adam | last post by:
Hello, I have a 2 column file that looks like this: VALUE1 | VALUE2 12 | 7 10 | 7 9 | 8 10 | 8 11 | 8 6 | 9 8 | 9
6
1667
by: Liz Malcolm | last post by:
Hello and Thanks in advance for any help. I am using Access 2000. I have a data entry form that opens a main form (using the On Click event of the combo box ) with tab controls and 1 subform on the last tab control. The main form is opened using a where clause to restrict the contact type. The subform is built on a separate table that...
5
10896
by: valglad | last post by:
Hi, The question below was posted about 4 years ago and noone was able to answer it back then. I have virtually the same type of problem so would appreciate if anyone can help. Thanks ======================================================================
9
2563
by: Greg Strong | last post by:
Hello All, What is the maximum length of an ODBC pass through query? Things work fine with the code except when I try to create a view which is pretty complex in Oracle. I'm using a DSN provided with the Oracle Express Edition and using Access 2k2 as the front-end. When I debug print the SQL and paste it into SQLplus it works fine. The...
0
2410
by: georges the man | last post by:
The purpose: • Sorting and Searching • Numerical Analysis Design Specification You are to write a program called “StockAnalyser”. Your program will read a text file that contains historical price of a stock. The program will allow users to query the stock price of a particular date and output its statistics (mean price, median price and...
0
7507
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.